From f3c2569a3003dae2b46270b99592bf1d9a7f34c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois?= Date: Sun, 16 Feb 2025 17:37:56 +0100 Subject: [PATCH] app dir changed and src dir removed --- .vscode/launch.json | 2 +- .vscode/settings.json | 6 ++- CMakeLists.txt | 2 +- app/src/common.c | 41 ------------------- {app => bs}/CMakeLists.txt | 3 +- {app/src => bs}/args.c | 0 {app/src => bs}/args.h | 0 {app/src => bs}/cmds/exit.c | 0 {app/src => bs}/cmds/exit.h | 0 {app/src => bs}/cmds/help.c | 0 {app/src => bs}/cmds/help.h | 0 {app/src => bs}/cmds/list_probes.c | 0 {app/src => bs}/cmds/list_probes.h | 0 {app/src => bs}/cmds/scan.c | 0 {app/src => bs}/cmds/scan.h | 0 {app/src => bs}/cmds/select_probe.c | 0 {app/src => bs}/cmds/select_probe.h | 0 bs/init.c | 63 +++++++++++++++++++++++++++++ bs/init.h | 17 ++++++++ {app/src => bs}/main.c | 0 app/src/common.h => bs/utils.h | 12 ------ {modules/jtag_core => bs}/version.h | 0 22 files changed, 88 insertions(+), 58 deletions(-) delete mode 100644 app/src/common.c rename {app => bs}/CMakeLists.txt (70%) rename {app/src => bs}/args.c (100%) rename {app/src => bs}/args.h (100%) rename {app/src => bs}/cmds/exit.c (100%) rename {app/src => bs}/cmds/exit.h (100%) rename {app/src => bs}/cmds/help.c (100%) rename {app/src => bs}/cmds/help.h (100%) rename {app/src => bs}/cmds/list_probes.c (100%) rename {app/src => bs}/cmds/list_probes.h (100%) rename {app/src => bs}/cmds/scan.c (100%) rename {app/src => bs}/cmds/scan.h (100%) rename {app/src => bs}/cmds/select_probe.c (100%) rename {app/src => bs}/cmds/select_probe.h (100%) create mode 100644 bs/init.c create mode 100644 bs/init.h rename {app/src => bs}/main.c (100%) rename app/src/common.h => bs/utils.h (55%) rename {modules/jtag_core => bs}/version.h (100%) diff --git a/.vscode/launch.json b/.vscode/launch.json index f51cf18..73e9465 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -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}", diff --git a/.vscode/settings.json b/.vscode/settings.json index 9405994..1b07813 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -9,5 +9,9 @@ "drivers_list.h": "c", "bsdl_loader.h": "c", "jtag_core_internal.h": "c" - } + }, + "C_Cpp.default.includePath": [ + "libs/", + "modules/" + ] } \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index 901d3d5..9e9425d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -22,4 +22,4 @@ foreach(module ${MODULES_DIRS}) endif() endforeach() -add_subdirectory(app) +add_subdirectory(bs) diff --git a/app/src/common.c b/app/src/common.c deleted file mode 100644 index d4ac0dc..0000000 --- a/app/src/common.c +++ /dev/null @@ -1,41 +0,0 @@ -#include -#include - -#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; -} \ No newline at end of file diff --git a/app/CMakeLists.txt b/bs/CMakeLists.txt similarity index 70% rename from app/CMakeLists.txt rename to bs/CMakeLists.txt index 5bd02b0..feeb8d0 100644 --- a/app/CMakeLists.txt +++ b/bs/CMakeLists.txt @@ -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 diff --git a/app/src/args.c b/bs/args.c similarity index 100% rename from app/src/args.c rename to bs/args.c diff --git a/app/src/args.h b/bs/args.h similarity index 100% rename from app/src/args.h rename to bs/args.h diff --git a/app/src/cmds/exit.c b/bs/cmds/exit.c similarity index 100% rename from app/src/cmds/exit.c rename to bs/cmds/exit.c diff --git a/app/src/cmds/exit.h b/bs/cmds/exit.h similarity index 100% rename from app/src/cmds/exit.h rename to bs/cmds/exit.h diff --git a/app/src/cmds/help.c b/bs/cmds/help.c similarity index 100% rename from app/src/cmds/help.c rename to bs/cmds/help.c diff --git a/app/src/cmds/help.h b/bs/cmds/help.h similarity index 100% rename from app/src/cmds/help.h rename to bs/cmds/help.h diff --git a/app/src/cmds/list_probes.c b/bs/cmds/list_probes.c similarity index 100% rename from app/src/cmds/list_probes.c rename to bs/cmds/list_probes.c diff --git a/app/src/cmds/list_probes.h b/bs/cmds/list_probes.h similarity index 100% rename from app/src/cmds/list_probes.h rename to bs/cmds/list_probes.h diff --git a/app/src/cmds/scan.c b/bs/cmds/scan.c similarity index 100% rename from app/src/cmds/scan.c rename to bs/cmds/scan.c diff --git a/app/src/cmds/scan.h b/bs/cmds/scan.h similarity index 100% rename from app/src/cmds/scan.h rename to bs/cmds/scan.h diff --git a/app/src/cmds/select_probe.c b/bs/cmds/select_probe.c similarity index 100% rename from app/src/cmds/select_probe.c rename to bs/cmds/select_probe.c diff --git a/app/src/cmds/select_probe.h b/bs/cmds/select_probe.h similarity index 100% rename from app/src/cmds/select_probe.h rename to bs/cmds/select_probe.h diff --git a/bs/init.c b/bs/init.c new file mode 100644 index 0000000..8567a64 --- /dev/null +++ b/bs/init.c @@ -0,0 +1,63 @@ +#include +#include + +/* +#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; +} \ No newline at end of file diff --git a/bs/init.h b/bs/init.h new file mode 100644 index 0000000..c03dff7 --- /dev/null +++ b/bs/init.h @@ -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 \ No newline at end of file diff --git a/app/src/main.c b/bs/main.c similarity index 100% rename from app/src/main.c rename to bs/main.c diff --git a/app/src/common.h b/bs/utils.h similarity index 55% rename from app/src/common.h rename to bs/utils.h index cf390b0..284df5c 100644 --- a/app/src/common.h +++ b/bs/utils.h @@ -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 \ No newline at end of file diff --git a/modules/jtag_core/version.h b/bs/version.h similarity index 100% rename from modules/jtag_core/version.h rename to bs/version.h