app dir changed and src dir removed

This commit is contained in:
2025-02-16 17:37:56 +01:00
parent 4f6cd20130
commit f3c2569a30
22 changed files with 88 additions and 58 deletions

2
.vscode/launch.json vendored
View File

@@ -8,7 +8,7 @@
"name": "bs list",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/build/app/bs",
"program": "${workspaceFolder}/build/bs/bs",
"args": [],
"stopAtEntry": false,
"cwd": "${fileDirname}",

View File

@@ -9,5 +9,9 @@
"drivers_list.h": "c",
"bsdl_loader.h": "c",
"jtag_core_internal.h": "c"
}
},
"C_Cpp.default.includePath": [
"libs/",
"modules/"
]
}

View File

@@ -22,4 +22,4 @@ foreach(module ${MODULES_DIRS})
endif()
endforeach()
add_subdirectory(app)
add_subdirectory(bs)

View File

@@ -1,41 +0,0 @@
#include <stddef.h>
#include <stdio.h>
#include "common.h"
#include "cmds/help.h"
#include "cmds/scan.h"
#include "cmds/list_probes.h"
#include "cmds/exit.h"
#include "cmds/select_probe.h"
// Table des commandes internes
Command commands[] = {
{"help", cmd_help, NULL},
{"list_probes", cmd_list_probes, cmd_list_probes_help},
{"scan", cmd_scan, cmd_scan_help},
{"select_probe", cmd_select_probe, cmd_select_probe_help},
{"exit", cmd_exit, cmd_exit_help},
{NULL, NULL}
};
void jprint(jtag_core *jc, const char *msg) {
printf(msg);
}
jtag_core * bsexp_init(void) {
jtag_core *ret = NULL;
/* initialize the JTAG library */
ret = jtagcore_init();
if (NULL != ret) {
/* Log printing callback */
if (jtagcore_set_logs_callback(ret, jprint) < 0) {
printf("Impossible to define the logs callback!\n");
} else {
jtagcore_set_logs_level(ret, MSG_DEBUG);
}
}
return ret;
}

View File

@@ -1,5 +1,5 @@
file(GLOB_RECURSE ALL_SOURCES "src/*.c")
file(GLOB_RECURSE ALL_SOURCES "*.c")
# Application configuration
add_executable(
@@ -7,7 +7,6 @@ add_executable(
${ALL_SOURCES}
)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/src)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../modules)
# linking configuration

63
bs/init.c Normal file
View File

@@ -0,0 +1,63 @@
#include <stddef.h>
#include <stdio.h>
/*
#include "common.h"
#include "cmds/help.h"
#include "cmds/scan.h"
#include "cmds/list_probes.h"
#include "cmds/exit.h"
#include "cmds/select_probe.h"
// Table des commandes internes
Command commands[] = {
{"help", cmd_help, NULL},
{"list_probes", cmd_list_probes, cmd_list_probes_help},
{"scan", cmd_scan, cmd_scan_help},
{"select_probe", cmd_select_probe, cmd_select_probe_help},
{"exit", cmd_exit, cmd_exit_help},
{NULL, NULL}};
*/
#include "jtag_core/jtag_core.h"
void jprint(jtag_core *jc, const char *msg)
{
printf(msg);
}
jtag_core *bsexp_init(void)
{
jtag_core *jc = NULL;
/* initialize the JTAG library */
jc = jtagcore_init();
if (NULL == jc) goto end;
jc->envvar = (void*)initEnv(NULL, NULL);
jtagcore_setEnvVar( jc, "VERSION", "v"jtag_core_VERSION);
sctx = jtagcore_initScript(jc);
jtagcore_execScriptRam( sctx, config_script, config_script_len );
jtagcore_execScriptFile( sctx, "config.script" );
/* Log printing callback */
if (jtagcore_set_logs_callback(jc, jprint) < 0)
{
printf("Impossible to define the logs callback!\n");
}
else
{
if(jtagcore_getEnvVar( jc, "LOG_MESSAGES_FILTER_LEVEL", NULL))
{
jtagcore_set_logs_level( jc, jtagcore_getEnvVarValue( jc, "LOG_MESSAGES_FILTER_LEVEL") );
}
}
end:
return jc;
}

17
bs/init.h Normal file
View File

@@ -0,0 +1,17 @@
#ifndef _UTILS_H
#define _UTILS_H
#include "jtag_core/jtag_core.h"
typedef int (*command_call)(jtag_core *jc, int argc, char *argv[]);
typedef struct {
char *name;
command_call cmd_call;
} Command;
extern Command commands[];
jtag_core *bsexp_init(void);
#endif

View File

@@ -1,7 +1,6 @@
#ifndef _UTILS_H
#define _UTILS_H
#include "jtag_core/jtag_core.h"
#define MAX_LINE 1024
#define MAX_ARGS 16
@@ -12,15 +11,4 @@
#define MIN(a,b) (((a)<(b))?(a):(b))
#define MAX(a,b) (((a)>(b))?(a):(b))
typedef int (*command_call)(jtag_core *jc, int argc, char *argv[]);
typedef struct {
char *name;
command_call cmd_call;
} Command;
extern Command commands[];
jtag_core *bsexp_init(void);
#endif