From ec060312b7fe73859227eb17b01eb6362cdfb136 Mon Sep 17 00:00:00 2001 From: greedyhao Date: Fri, 11 Dec 2020 18:33:09 +0800 Subject: [PATCH] [bluetrum] add --dist --- bsp/bluetrum/ab32vg1-ab-prougen/.gitignore | 1 + bsp/bluetrum/ab32vg1-ab-prougen/README.md | 2 +- bsp/bluetrum/ab32vg1-ab-prougen/SConstruct | 2 +- bsp/bluetrum/ab32vg1-ab-prougen/cconfig.h | 11 +++++++++- bsp/bluetrum/ab32vg1-ab-prougen/rtconfig.py | 9 +++++++- bsp/bluetrum/libcpu/{ => cpu}/SConscript | 0 bsp/bluetrum/libcpu/{ => cpu}/context_gcc.S | 0 bsp/bluetrum/libcpu/{ => cpu}/cpuport.c | 0 bsp/bluetrum/libcpu/{ => cpu}/interrupt.c | 0 bsp/bluetrum/tools/sdk_dist.py | 24 +++++++++++++++++++++ 10 files changed, 45 insertions(+), 4 deletions(-) rename bsp/bluetrum/libcpu/{ => cpu}/SConscript (100%) rename bsp/bluetrum/libcpu/{ => cpu}/context_gcc.S (100%) rename bsp/bluetrum/libcpu/{ => cpu}/cpuport.c (100%) rename bsp/bluetrum/libcpu/{ => cpu}/interrupt.c (100%) create mode 100644 bsp/bluetrum/tools/sdk_dist.py diff --git a/bsp/bluetrum/ab32vg1-ab-prougen/.gitignore b/bsp/bluetrum/ab32vg1-ab-prougen/.gitignore index 00b6f02b70..37749b0928 100644 --- a/bsp/bluetrum/ab32vg1-ab-prougen/.gitignore +++ b/bsp/bluetrum/ab32vg1-ab-prougen/.gitignore @@ -7,3 +7,4 @@ *.old build +dist diff --git a/bsp/bluetrum/ab32vg1-ab-prougen/README.md b/bsp/bluetrum/ab32vg1-ab-prougen/README.md index 35f08e20bb..d761cfce45 100644 --- a/bsp/bluetrum/ab32vg1-ab-prougen/README.md +++ b/bsp/bluetrum/ab32vg1-ab-prougen/README.md @@ -102,7 +102,7 @@ msh > ## 注意事项 -目前的 `cconfig.h` 的生成脚本对 riscv 的工具链识别有问题,可能需要在 `cconfig.h` 中手动添加以下配置 +编译报错的时候,如果出现重复定义的报错,可能需要在 `cconfig.h` 中手动添加以下配置 ``` #define HAVE_SIGEVENT 1 diff --git a/bsp/bluetrum/ab32vg1-ab-prougen/SConstruct b/bsp/bluetrum/ab32vg1-ab-prougen/SConstruct index 8afae966f8..697488940c 100644 --- a/bsp/bluetrum/ab32vg1-ab-prougen/SConstruct +++ b/bsp/bluetrum/ab32vg1-ab-prougen/SConstruct @@ -55,7 +55,7 @@ objs.extend(SConscript(os.path.join(libraries_path_prefix, bsp_library_type, 'SC objs.extend(SConscript(os.path.join(libraries_path_prefix, 'hal_drivers', 'SConscript'))) # include drivers -objs.extend(SConscript(os.path.join(libcpu_path_prefix, 'SConscript'))) +objs.extend(SConscript(os.path.join(libcpu_path_prefix, 'cpu', 'SConscript'))) # make a building DoBuilding(TARGET, objs) diff --git a/bsp/bluetrum/ab32vg1-ab-prougen/cconfig.h b/bsp/bluetrum/ab32vg1-ab-prougen/cconfig.h index 9c81dd397d..074cbd3397 100644 --- a/bsp/bluetrum/ab32vg1-ab-prougen/cconfig.h +++ b/bsp/bluetrum/ab32vg1-ab-prougen/cconfig.h @@ -3,10 +3,19 @@ /* Automatically generated file; DO NOT EDIT. */ /* compiler configure file for RT-Thread in GCC*/ +#define HAVE_NEWLIB_H 1 +#define LIBC_VERSION "newlib 3.2.0" -#define STDC "1989" +#define HAVE_SYS_SIGNAL_H 1 +#define HAVE_SYS_SELECT_H 1 +#define HAVE_PTHREAD_H 1 + +#define HAVE_FDSET 1 +#define HAVE_SIGACTION 1 #define HAVE_SIGEVENT 1 #define HAVE_SIGINFO 1 #define HAVE_SIGVAL 1 +#define GCC_VERSION_STR "10.1.0" +#define STDC "2011" #endif diff --git a/bsp/bluetrum/ab32vg1-ab-prougen/rtconfig.py b/bsp/bluetrum/ab32vg1-ab-prougen/rtconfig.py index b782e0d2c2..300d845047 100644 --- a/bsp/bluetrum/ab32vg1-ab-prougen/rtconfig.py +++ b/bsp/bluetrum/ab32vg1-ab-prougen/rtconfig.py @@ -57,4 +57,11 @@ if PLATFORM == 'gcc': DUMP_ACTION = OBJDUMP + ' -D -S $TARGET > rtt.asm\n' POST_ACTION = OBJCPY + ' -O binary $TARGET rtthread.bin\n' + SIZE + ' $TARGET \n' -POST_ACTION += './riscv32-elf-xmaker -b rtthread.xm\n' \ No newline at end of file +POST_ACTION += './riscv32-elf-xmaker -b rtthread.xm\n' + +def dist_handle(BSP_ROOT, dist_dir): + import sys + cwd_path = os.getcwd() + sys.path.append(os.path.join(os.path.dirname(BSP_ROOT), 'tools')) + from sdk_dist import dist_do_building + dist_do_building(BSP_ROOT, dist_dir) diff --git a/bsp/bluetrum/libcpu/SConscript b/bsp/bluetrum/libcpu/cpu/SConscript similarity index 100% rename from bsp/bluetrum/libcpu/SConscript rename to bsp/bluetrum/libcpu/cpu/SConscript diff --git a/bsp/bluetrum/libcpu/context_gcc.S b/bsp/bluetrum/libcpu/cpu/context_gcc.S similarity index 100% rename from bsp/bluetrum/libcpu/context_gcc.S rename to bsp/bluetrum/libcpu/cpu/context_gcc.S diff --git a/bsp/bluetrum/libcpu/cpuport.c b/bsp/bluetrum/libcpu/cpu/cpuport.c similarity index 100% rename from bsp/bluetrum/libcpu/cpuport.c rename to bsp/bluetrum/libcpu/cpu/cpuport.c diff --git a/bsp/bluetrum/libcpu/interrupt.c b/bsp/bluetrum/libcpu/cpu/interrupt.c similarity index 100% rename from bsp/bluetrum/libcpu/interrupt.c rename to bsp/bluetrum/libcpu/cpu/interrupt.c diff --git a/bsp/bluetrum/tools/sdk_dist.py b/bsp/bluetrum/tools/sdk_dist.py new file mode 100644 index 0000000000..e40064fb84 --- /dev/null +++ b/bsp/bluetrum/tools/sdk_dist.py @@ -0,0 +1,24 @@ +import os +import sys +import shutil +cwd_path = os.getcwd() +sys.path.append(os.path.join(os.path.dirname(cwd_path), 'rt-thread', 'tools')) + +# BSP dist function +def dist_do_building(BSP_ROOT, dist_dir): + from mkdist import bsp_copy_files + import rtconfig + + library_dir = os.path.join(dist_dir, 'libraries') + + print("=> copy bluetrum bsp library") + library_path = os.path.join(os.path.dirname(BSP_ROOT), 'libraries') + library_dir = os.path.join(dist_dir, 'libraries') + bsp_copy_files(os.path.join(library_path, rtconfig.BSP_LIBRARY_TYPE), os.path.join(library_dir, rtconfig.BSP_LIBRARY_TYPE)) + + print("=> copy bsp drivers") + bsp_copy_files(os.path.join(library_path, 'hal_drivers'), os.path.join(library_dir, 'hal_drivers')) + # shutil.copyfile(os.path.join(library_path, 'Kconfig'), os.path.join(library_dir, 'Kconfig')) + + print("=> copy libcpu") + bsp_copy_files(os.path.join(os.path.dirname(BSP_ROOT), 'libcpu'), os.path.join(dist_dir, 'libcpu')) -- GitLab