diff --git a/bsp/maxim/MAX32660_EVSYS/rtconfig.py b/bsp/maxim/MAX32660_EVSYS/rtconfig.py
index 97130e34f5..70faf43ff9 100644
--- a/bsp/maxim/MAX32660_EVSYS/rtconfig.py
+++ b/bsp/maxim/MAX32660_EVSYS/rtconfig.py
@@ -133,3 +133,11 @@ elif PLATFORM == 'iar':
EXEC_PATH = EXEC_PATH + '/arm/bin/'
POST_ACTION = 'ielftool --bin $TARGET rtthread.bin'
+
+
+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)
\ No newline at end of file
diff --git a/bsp/maxim/tools/sdk_dist.py b/bsp/maxim/tools/sdk_dist.py
new file mode 100644
index 0000000000..2bc57c6b95
--- /dev/null
+++ b/bsp/maxim/tools/sdk_dist.py
@@ -0,0 +1,21 @@
+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
+
+ print("=> copy maxim bsp library")
+ library_dir = os.path.join(dist_dir, 'libraries')
+ library_path = os.path.join(os.path.dirname(BSP_ROOT), 'libraries')
+
+ print("=> copy bsp drivers")
+ bsp_copy_files(os.path.join(library_path, 'HAL_Drivers'), os.path.join(library_dir, 'HAL_Drivers'))
+ bsp_copy_files(os.path.join(library_path, 'MAX32660PeriphDriver'), os.path.join(library_dir, 'MAX32660PeriphDriver'))
+
\ No newline at end of file
diff --git a/bsp/smartfusion2/project.uvopt b/bsp/smartfusion2/project.uvopt
index 99ce043dfe..51eba0e604 100644
--- a/bsp/smartfusion2/project.uvopt
+++ b/bsp/smartfusion2/project.uvopt
@@ -110,10 +110,10 @@
1
0
1
- 1
+ 0
1
1
- 0
+ 1
0
0
6
@@ -177,7 +177,7 @@
- Kernel
+ Applications
0
0
0
@@ -193,8 +193,8 @@
0
0
0
- ..\..\src\clock.c
- clock.c
+ applications\main.c
+ main.c
0
0
@@ -209,246 +209,14 @@
0
0
0
- ..\..\src\components.c
- components.c
- 0
- 0
-
-
- 1
- 3
- 1
- 0
- 0
- 0
- 0
- 0
- 0
- 0
- ..\..\src\device.c
- device.c
- 0
- 0
-
-
- 1
- 4
- 1
- 0
- 0
- 0
- 0
- 0
- 0
- 0
- ..\..\src\idle.c
- idle.c
- 0
- 0
-
-
- 1
- 5
- 1
- 0
- 0
- 0
- 0
- 0
- 0
- 0
- ..\..\src\ipc.c
- ipc.c
- 0
- 0
-
-
- 1
- 6
- 1
- 0
- 0
- 0
- 0
- 0
- 0
- 0
- ..\..\src\irq.c
- irq.c
- 0
- 0
-
-
- 1
- 7
- 1
- 0
- 0
- 0
- 0
- 0
- 0
- 0
- ..\..\src\kservice.c
- kservice.c
- 0
- 0
-
-
- 1
- 8
- 1
- 0
- 0
- 0
- 0
- 0
- 0
- 0
- ..\..\src\mem.c
- mem.c
- 0
- 0
-
-
- 1
- 9
- 1
- 0
- 0
- 0
- 0
- 0
- 0
- 0
- ..\..\src\mempool.c
- mempool.c
- 0
- 0
-
-
- 1
- 10
- 1
- 0
- 0
- 0
- 0
- 0
- 0
- 0
- ..\..\src\object.c
- object.c
- 0
- 0
-
-
- 1
- 11
- 1
- 0
- 0
- 0
- 0
- 0
- 0
- 0
- ..\..\src\scheduler.c
- scheduler.c
- 0
- 0
-
-
- 1
- 12
- 1
- 0
- 0
- 0
- 0
- 0
- 0
- 0
- ..\..\src\signal.c
- signal.c
- 0
- 0
-
-
- 1
- 13
- 1
- 0
- 0
- 0
- 0
- 0
- 0
- 0
- ..\..\src\thread.c
- thread.c
- 0
- 0
-
-
- 1
- 14
- 1
- 0
- 0
- 0
- 0
- 0
- 0
- 0
- ..\..\src\timer.c
- timer.c
- 0
- 0
-
-
-
-
- Applications
- 1
- 0
- 0
- 0
-
- 2
- 15
- 1
- 0
- 0
- 14
- 0
- 1
- 16
- 0
- applications\main.c
- main.c
- 0
- 0
-
-
- 2
- 16
- 1
- 0
- 0
- 0
- 0
- 0
- 0
- 0
board\board.c
board.c
0
0
- 2
- 17
+ 1
+ 3
1
0
0
@@ -471,8 +239,8 @@
0
0
- 3
- 18
+ 2
+ 4
1
0
0
@@ -487,8 +255,8 @@
0
- 3
- 19
+ 2
+ 5
1
0
0
@@ -503,8 +271,8 @@
0
- 3
- 20
+ 2
+ 6
2
0
0
@@ -521,110 +289,14 @@
- Drivers
- 1
- 0
- 0
- 0
-
- 4
- 21
- 1
- 0
- 0
- 0
- 0
- 0
- 0
- 0
- drivers\drv_uart.c
- drv_uart.c
- 0
- 0
-
-
- 4
- 22
- 1
- 0
- 0
- 0
- 0
- 0
- 0
- 0
- drivers\drv_gpio.c
- drv_gpio.c
- 0
- 0
-
-
-
-
- Libraries
- 1
- 0
- 0
- 0
-
- 5
- 23
- 1
- 0
- 0
- 0
- 0
- 0
- 0
- 0
- libraries\sys_config\sys_config.c
- sys_config.c
- 0
- 0
-
-
- 5
- 24
- 1
- 0
- 0
- 0
- 0
- 0
- 0
- 0
- libraries\mss_gpio\mss_gpio.c
- mss_gpio.c
- 0
- 0
-
-
- 5
- 25
- 1
- 0
- 0
- 0
- 0
- 0
- 0
- 0
- libraries\mss_uart\mss_uart.c
- mss_uart.c
- 0
- 0
-
-
-
-
- cpu
+ CPU
0
0
0
0
- 6
- 26
+ 3
+ 7
1
0
0
@@ -639,8 +311,8 @@
0
- 6
- 27
+ 3
+ 8
1
0
0
@@ -655,8 +327,8 @@
0
- 6
- 28
+ 3
+ 9
1
0
0
@@ -671,8 +343,8 @@
0
- 6
- 29
+ 3
+ 10
1
0
0
@@ -687,8 +359,8 @@
0
- 6
- 30
+ 3
+ 11
2
0
0
@@ -711,8 +383,8 @@
0
0
- 7
- 31
+ 4
+ 12
1
0
0
@@ -727,8 +399,8 @@
0
- 7
- 32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syscalls.c
0
0
- 9
- 46
+ 8
+ 42
+ 1
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ ..\..\components\libc\compilers\common\stdlib.c
+ stdlib.c
+ 0
+ 0
+
+
+ 8
+ 43
1
0
0
@@ -984,4 +928,60 @@
+
+ Libraries
+ 0
+ 0
+ 0
+ 0
+
+ 9
+ 44
+ 1
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ libraries\sys_config\sys_config.c
+ sys_config.c
+ 0
+ 0
+
+
+ 9
+ 45
+ 1
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ libraries\mss_gpio\mss_gpio.c
+ mss_gpio.c
+ 0
+ 0
+
+
+ 9
+ 46
+ 1
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ libraries\mss_uart\mss_uart.c
+ mss_uart.c
+ 0
+ 0
+
+
+
diff --git a/bsp/smartfusion2/project.uvoptx b/bsp/smartfusion2/project.uvoptx
index a83e5093d3..57f994ae2b 100644
--- a/bsp/smartfusion2/project.uvoptx
+++ b/bsp/smartfusion2/project.uvoptx
@@ -175,7 +175,7 @@
- Kernel
+ Applications
0
0
0
@@ -187,8 +187,8 @@
0
0
0
- ..\..\src\clock.c
- clock.c
+ applications\main.c
+ main.c
0
0
@@ -199,190 +199,14 @@
0
0
0
- ..\..\src\components.c
- components.c
- 0
- 0
-
-
- 1
- 3
- 1
- 0
- 0
- 0
- ..\..\src\device.c
- device.c
- 0
- 0
-
-
- 1
- 4
- 1
- 0
- 0
- 0
- ..\..\src\idle.c
- idle.c
- 0
- 0
-
-
- 1
- 5
- 1
- 0
- 0
- 0
- ..\..\src\ipc.c
- ipc.c
- 0
- 0
-
-
- 1
- 6
- 1
- 0
- 0
- 0
- ..\..\src\irq.c
- irq.c
- 0
- 0
-
-
- 1
- 7
- 1
- 0
- 0
- 0
- ..\..\src\kservice.c
- kservice.c
- 0
- 0
-
-
- 1
- 8
- 1
- 0
- 0
- 0
- ..\..\src\mem.c
- mem.c
- 0
- 0
-
-
- 1
- 9
- 1
- 0
- 0
- 0
- ..\..\src\mempool.c
- mempool.c
- 0
- 0
-
-
- 1
- 10
- 1
- 0
- 0
- 0
- ..\..\src\object.c
- object.c
- 0
- 0
-
-
- 1
- 11
- 1
- 0
- 0
- 0
- ..\..\src\scheduler.c
- scheduler.c
- 0
- 0
-
-
- 1
- 12
- 1
- 0
- 0
- 0
- ..\..\src\signal.c
- signal.c
- 0
- 0
-
-
- 1
- 13
- 1
- 0
- 0
- 0
- ..\..\src\thread.c
- thread.c
- 0
- 0
-
-
- 1
- 14
- 1
- 0
- 0
- 0
- ..\..\src\timer.c
- timer.c
- 0
- 0
-
-
-
-
- Applications
- 1
- 0
- 0
- 0
-
- 2
- 15
- 1
- 0
- 0
- 0
- applications\main.c
- main.c
- 0
- 0
-
-
- 2
- 16
- 1
- 0
- 0
- 0
board\board.c
board.c
0
0
- 2
- 17
+ 1
+ 3
1
0
0
@@ -401,8 +225,8 @@
0
0
- 3
- 18
+ 2
+ 4
1
0
0
@@ -413,8 +237,8 @@
0
- 3
- 19
+ 2
+ 5
1
0
0
@@ -425,8 +249,8 @@
0
- 3
- 20
+ 2
+ 6
2
0
0
@@ -439,90 +263,14 @@
- Drivers
- 1
- 0
- 0
- 0
-
- 4
- 21
- 1
- 0
- 0
- 0
- drivers\drv_uart.c
- drv_uart.c
- 0
- 0
-
-
- 4
- 22
- 1
- 0
- 0
- 0
- drivers\drv_gpio.c
- drv_gpio.c
- 0
- 0
-
-
-
-
- Libraries
- 1
- 0
- 0
- 0
-
- 5
- 23
- 1
- 0
- 0
- 0
- libraries\sys_config\sys_config.c
- sys_config.c
- 0
- 0
-
-
- 5
- 24
- 1
- 0
- 0
- 0
- libraries\mss_gpio\mss_gpio.c
- mss_gpio.c
- 0
- 0
-
-
- 5
- 25
- 1
- 0
- 0
- 0
- libraries\mss_uart\mss_uart.c
- mss_uart.c
- 0
- 0
-
-
-
-
- cpu
+ CPU
0
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1
+ 0
+ 0
+ 0
+ ..\..\src\components.c
+ components.c
+ 0
+ 0
+
+
+ 7
+ 28
+ 1
+ 0
+ 0
+ 0
+ ..\..\src\device.c
+ device.c
+ 0
+ 0
+
+
+ 7
+ 29
+ 1
+ 0
+ 0
+ 0
+ ..\..\src\idle.c
+ idle.c
+ 0
+ 0
+
+
+ 7
+ 30
+ 1
+ 0
+ 0
+ 0
+ ..\..\src\ipc.c
+ ipc.c
+ 0
+ 0
+
+
+ 7
+ 31
+ 1
+ 0
+ 0
+ 0
+ ..\..\src\irq.c
+ irq.c
+ 0
+ 0
+
+
+ 7
+ 32
+ 1
+ 0
+ 0
+ 0
+ ..\..\src\kservice.c
+ kservice.c
+ 0
+ 0
+
+
+ 7
+ 33
+ 1
+ 0
+ 0
+ 0
+ ..\..\src\mem.c
+ mem.c
+ 0
+ 0
+
+
+ 7
+ 34
+ 1
+ 0
+ 0
+ 0
+ ..\..\src\mempool.c
+ mempool.c
+ 0
+ 0
+
+
+ 7
+ 35
+ 1
+ 0
+ 0
+ 0
+ ..\..\src\object.c
+ object.c
+ 0
+ 0
+
+
+ 7
+ 36
+ 1
+ 0
+ 0
+ 0
+ ..\..\src\scheduler.c
+ scheduler.c
+ 0
+ 0
+
+
+ 7
+ 37
+ 1
+ 0
+ 0
+ 0
+ ..\..\src\thread.c
+ thread.c
+ 0
+ 0
+
+
+ 7
+ 38
+ 1
+ 0
+ 0
+ 0
+ ..\..\src\timer.c
+ timer.c
+ 0
+ 0
+
+
+
libc
0
@@ -749,8 +693,8 @@
0
0
- 9
- 43
+ 8
+ 39
1
0
0
@@ -761,8 +705,8 @@
0
- 9
- 44
+ 8
+ 40
1
0
0
@@ -773,20 +717,32 @@
0
- 9
- 45
+ 8
+ 41
1
0
0
0
- ..\..\components\libc\compilers\armlibc\stubs.c
- stubs.c
+ ..\..\components\libc\compilers\armlibc\syscalls.c
+ syscalls.c
0
0
- 9
- 46
+ 8
+ 42
+ 1
+ 0
+ 0
+ 0
+ ..\..\components\libc\compilers\common\stdlib.c
+ stdlib.c
+ 0
+ 0
+
+
+ 8
+ 43
1
0
0
@@ -798,4 +754,48 @@
+
+ Libraries
+ 0
+ 0
+ 0
+ 0
+
+ 9
+ 44
+ 1
+ 0
+ 0
+ 0
+ libraries\sys_config\sys_config.c
+ sys_config.c
+ 0
+ 0
+
+
+ 9
+ 45
+ 1
+ 0
+ 0
+ 0
+ libraries\mss_gpio\mss_gpio.c
+ mss_gpio.c
+ 0
+ 0
+
+
+ 9
+ 46
+ 1
+ 0
+ 0
+ 0
+ libraries\mss_uart\mss_uart.c
+ mss_uart.c
+ 0
+ 0
+
+
+
diff --git a/bsp/smartfusion2/project.uvproj b/bsp/smartfusion2/project.uvproj
index 34dc365986..2ee7c71eee 100644
--- a/bsp/smartfusion2/project.uvproj
+++ b/bsp/smartfusion2/project.uvproj
@@ -139,9 +139,9 @@
1
0
1
- 1
+ 0
1
- 0
+ 1
0
6
@@ -170,7 +170,7 @@
0
-1
- 1
+ 0
BIN\UL2CM3.DLL
@@ -356,13 +356,13 @@
0
0
0
- 0
+ 1
0
- RT_USING_ARM_LIBC
+ RT_USING_ARM_LIBC, __RTTHREAD__, __CLK_TCK=RT_TICK_PER_SECOND
- .;..\..\include;applications;board;CMSIS;drivers;libraries\sys_config;libraries\mss_gpio;libraries\mss_uart;..\..\libcpu\arm\common;..\..\libcpu\arm\cortex-m3;..\..\components\drivers\include;..\..\components\drivers\include;..\..\components\drivers\include;..\..\components\finsh;..\..\components\libc\compilers\armlibc;..\..\components\libc\compilers\common
+ applications;board;CMSIS;..\..\libcpu\arm\common;..\..\libcpu\arm\cortex-m3;..\..\components\drivers\include;..\..\components\drivers\include;..\..\components\drivers\include;drivers;..\..\components\finsh;.;..\..\include;..\..\components\libc\compilers\armlibc;..\..\components\libc\compilers\common;libraries\sys_config;libraries\mss_gpio;libraries\mss_uart
@@ -402,81 +402,6 @@
-
- Kernel
-
-
- clock.c
- 1
- ..\..\src\clock.c
-
-
- components.c
- 1
- ..\..\src\components.c
-
-
- device.c
- 1
- ..\..\src\device.c
-
-
- idle.c
- 1
- ..\..\src\idle.c
-
-
- ipc.c
- 1
- ..\..\src\ipc.c
-
-
- irq.c
- 1
- ..\..\src\irq.c
-
-
- kservice.c
- 1
- ..\..\src\kservice.c
-
-
- mem.c
- 1
- ..\..\src\mem.c
-
-
- mempool.c
- 1
- ..\..\src\mempool.c
-
-
- object.c
- 1
- ..\..\src\object.c
-
-
- scheduler.c
- 1
- ..\..\src\scheduler.c
-
-
- signal.c
- 1
- ..\..\src\signal.c
-
-
- thread.c
- 1
- ..\..\src\thread.c
-
-
- timer.c
- 1
- ..\..\src\timer.c
-
-
-
Applications
@@ -518,42 +443,7 @@
- Drivers
-
-
- drv_uart.c
- 1
- drivers\drv_uart.c
-
-
- drv_gpio.c
- 1
- drivers\drv_gpio.c
-
-
-
-
- Libraries
-
-
- sys_config.c
- 1
- libraries\sys_config\sys_config.c
-
-
- mss_gpio.c
- 1
- libraries\mss_gpio\mss_gpio.c
-
-
- mss_uart.c
- 1
- libraries\mss_uart\mss_uart.c
-
-
-
-
- cpu
+ CPU
backtrace.c
@@ -632,6 +522,21 @@
+
+ Drivers
+
+
+ drv_uart.c
+ 1
+ drivers\drv_uart.c
+
+
+ drv_gpio.c
+ 1
+ drivers\drv_gpio.c
+
+
+
finsh
@@ -652,6 +557,76 @@
+
+ Kernel
+
+
+ clock.c
+ 1
+ ..\..\src\clock.c
+
+
+ components.c
+ 1
+ ..\..\src\components.c
+
+
+ device.c
+ 1
+ ..\..\src\device.c
+
+
+ idle.c
+ 1
+ ..\..\src\idle.c
+
+
+ ipc.c
+ 1
+ ..\..\src\ipc.c
+
+
+ irq.c
+ 1
+ ..\..\src\irq.c
+
+
+ kservice.c
+ 1
+ ..\..\src\kservice.c
+
+
+ mem.c
+ 1
+ ..\..\src\mem.c
+
+
+ mempool.c
+ 1
+ ..\..\src\mempool.c
+
+
+ object.c
+ 1
+ ..\..\src\object.c
+
+
+ scheduler.c
+ 1
+ ..\..\src\scheduler.c
+
+
+ thread.c
+ 1
+ ..\..\src\thread.c
+
+
+ timer.c
+ 1
+ ..\..\src\timer.c
+
+
+
libc
@@ -666,9 +641,14 @@
..\..\components\libc\compilers\armlibc\mem_std.c
- stubs.c
+ syscalls.c
1
- ..\..\components\libc\compilers\armlibc\stubs.c
+ ..\..\components\libc\compilers\armlibc\syscalls.c
+
+
+ stdlib.c
+ 1
+ ..\..\components\libc\compilers\common\stdlib.c
time.c
@@ -677,6 +657,26 @@
+
+ Libraries
+
+
+ sys_config.c
+ 1
+ libraries\sys_config\sys_config.c
+
+
+ mss_gpio.c
+ 1
+ libraries\mss_gpio\mss_gpio.c
+
+
+ mss_uart.c
+ 1
+ libraries\mss_uart\mss_uart.c
+
+
+
diff --git a/bsp/smartfusion2/project.uvprojx b/bsp/smartfusion2/project.uvprojx
index 16914df12d..738524c6cb 100644
--- a/bsp/smartfusion2/project.uvprojx
+++ b/bsp/smartfusion2/project.uvprojx
@@ -10,7 +10,7 @@
project
0x4
ARM-ADS
- 5060750::V5.06 update 6 (build 750)::ARMCC
+ 5060750::V5.06 update 6 (build 750)::.\ARMCC
0
@@ -185,6 +185,7 @@
0
0
0
+ 0
0
0
8
@@ -324,7 +325,7 @@
2
0
0
- 0
+ 1
0
0
1
@@ -336,9 +337,9 @@
0
- RT_USING_ARM_LIBC
+ RT_USING_ARM_LIBC, __RTTHREAD__, __CLK_TCK=RT_TICK_PER_SECOND
- .;..\..\include;applications;board;CMSIS;drivers;libraries\sys_config;libraries\mss_gpio;libraries\mss_uart;..\..\libcpu\arm\common;..\..\libcpu\arm\cortex-m3;..\..\components\drivers\include;..\..\components\drivers\include;..\..\components\drivers\include;..\..\components\finsh;..\..\components\libc\compilers\armlibc;..\..\components\libc\compilers\common
+ applications;board;CMSIS;..\..\libcpu\arm\common;..\..\libcpu\arm\cortex-m3;..\..\components\drivers\include;..\..\components\drivers\include;..\..\components\drivers\include;drivers;..\..\components\finsh;.;..\..\include;..\..\components\libc\compilers\armlibc;..\..\components\libc\compilers\common;libraries\sys_config;libraries\mss_gpio;libraries\mss_uart
@@ -351,7 +352,7 @@
0
0
0
- 0
+ 4
@@ -379,81 +380,6 @@
-
- Kernel
-
-
- clock.c
- 1
- ..\..\src\clock.c
-
-
- components.c
- 1
- ..\..\src\components.c
-
-
- device.c
- 1
- ..\..\src\device.c
-
-
- idle.c
- 1
- ..\..\src\idle.c
-
-
- ipc.c
- 1
- ..\..\src\ipc.c
-
-
- irq.c
- 1
- ..\..\src\irq.c
-
-
- kservice.c
- 1
- ..\..\src\kservice.c
-
-
- mem.c
- 1
- ..\..\src\mem.c
-
-
- mempool.c
- 1
- ..\..\src\mempool.c
-
-
- object.c
- 1
- ..\..\src\object.c
-
-
- scheduler.c
- 1
- ..\..\src\scheduler.c
-
-
- signal.c
- 1
- ..\..\src\signal.c
-
-
- thread.c
- 1
- ..\..\src\thread.c
-
-
- timer.c
- 1
- ..\..\src\timer.c
-
-
-
Applications
@@ -495,42 +421,7 @@
- Drivers
-
-
- drv_uart.c
- 1
- drivers\drv_uart.c
-
-
- drv_gpio.c
- 1
- drivers\drv_gpio.c
-
-
-
-
- Libraries
-
-
- sys_config.c
- 1
- libraries\sys_config\sys_config.c
-
-
- mss_gpio.c
- 1
- libraries\mss_gpio\mss_gpio.c
-
-
- mss_uart.c
- 1
- libraries\mss_uart\mss_uart.c
-
-
-
-
- cpu
+ CPU
backtrace.c
@@ -609,6 +500,21 @@
+
+ Drivers
+
+
+ drv_uart.c
+ 1
+ drivers\drv_uart.c
+
+
+ drv_gpio.c
+ 1
+ drivers\drv_gpio.c
+
+
+
finsh
@@ -629,6 +535,76 @@
+
+ Kernel
+
+
+ clock.c
+ 1
+ ..\..\src\clock.c
+
+
+ components.c
+ 1
+ ..\..\src\components.c
+
+
+ device.c
+ 1
+ ..\..\src\device.c
+
+
+ idle.c
+ 1
+ ..\..\src\idle.c
+
+
+ ipc.c
+ 1
+ ..\..\src\ipc.c
+
+
+ irq.c
+ 1
+ ..\..\src\irq.c
+
+
+ kservice.c
+ 1
+ ..\..\src\kservice.c
+
+
+ mem.c
+ 1
+ ..\..\src\mem.c
+
+
+ mempool.c
+ 1
+ ..\..\src\mempool.c
+
+
+ object.c
+ 1
+ ..\..\src\object.c
+
+
+ scheduler.c
+ 1
+ ..\..\src\scheduler.c
+
+
+ thread.c
+ 1
+ ..\..\src\thread.c
+
+
+ timer.c
+ 1
+ ..\..\src\timer.c
+
+
+
libc
@@ -643,9 +619,14 @@
..\..\components\libc\compilers\armlibc\mem_std.c
- stubs.c
+ syscalls.c
1
- ..\..\components\libc\compilers\armlibc\stubs.c
+ ..\..\components\libc\compilers\armlibc\syscalls.c
+
+
+ stdlib.c
+ 1
+ ..\..\components\libc\compilers\common\stdlib.c
time.c
@@ -654,6 +635,26 @@
+
+ Libraries
+
+
+ sys_config.c
+ 1
+ libraries\sys_config\sys_config.c
+
+
+ mss_gpio.c
+ 1
+ libraries\mss_gpio\mss_gpio.c
+
+
+ mss_uart.c
+ 1
+ libraries\mss_uart\mss_uart.c
+
+
+
@@ -664,4 +665,19 @@
+
+
+
+ <Project Info>
+
+
+
+
+
+ 0
+ 1
+
+
+
+
diff --git a/bsp/smartfusion2/template.uvopt b/bsp/smartfusion2/template.uvopt
index 70eae785e9..8735ccdd69 100644
--- a/bsp/smartfusion2/template.uvopt
+++ b/bsp/smartfusion2/template.uvopt
@@ -110,10 +110,10 @@
1
0
1
- 1
+ 0
1
1
- 0
+ 1
0
0
6
diff --git a/bsp/smartfusion2/template.uvproj b/bsp/smartfusion2/template.uvproj
index 99fded24dc..356db37361 100644
--- a/bsp/smartfusion2/template.uvproj
+++ b/bsp/smartfusion2/template.uvproj
@@ -139,9 +139,9 @@
1
0
1
- 1
+ 0
1
- 0
+ 1
0
6
@@ -170,7 +170,7 @@
0
-1
- 1
+ 0
BIN\UL2CM3.DLL
@@ -356,7 +356,7 @@
0
0
0
- 0
+ 1
0
diff --git a/bsp/smartfusion2/template.uvprojx b/bsp/smartfusion2/template.uvprojx
index dbfd0815c2..56ef79c76d 100644
--- a/bsp/smartfusion2/template.uvprojx
+++ b/bsp/smartfusion2/template.uvprojx
@@ -185,6 +185,7 @@
0
0
0
+ 0
0
0
8
@@ -324,7 +325,7 @@
2
0
0
- 0
+ 1
0
0
1
@@ -351,7 +352,7 @@
0
0
0
- 0
+ 4
@@ -392,4 +393,19 @@
+
+
+
+ <Project Info>
+
+
+
+
+
+ 0
+ 1
+
+
+
+
diff --git a/components/finsh/msh_file.c b/components/finsh/msh_file.c
index 1368838b94..aa182ff9b3 100644
--- a/components/finsh/msh_file.c
+++ b/components/finsh/msh_file.c
@@ -101,7 +101,7 @@ int msh_exec_script(const char *cmd_line, int size)
int length;
line_buf = (char *) rt_malloc(RT_CONSOLEBUF_SIZE);
- if (line_buf == RT_NULL)
+ if (line_buf == RT_NULL)
{
close(fd);
return -RT_ENOMEM;
@@ -295,7 +295,7 @@ static void directory_delete_for_msh(const char *pathname, char f, char v)
if (dirent == RT_NULL)
break;
if (rt_strcmp(".", dirent->d_name) != 0 &&
- rt_strcmp("..", dirent->d_name) != 0)
+ rt_strcmp("..", dirent->d_name) != 0)
{
rt_sprintf(full_path, "%s/%s", pathname, dirent->d_name);
if (dirent->d_type == DT_REG)
@@ -347,13 +347,20 @@ int cmd_rm(int argc, char **argv)
{
switch (argv[1][n])
{
- case 'f': f = 1; break;
- case 'r': r = 1; break;
- case 'v': v = 1; break;
- case '-': break;
- default:
- rt_kprintf("Error: Bad option: %c\n", argv[1][n]);
- return 0;
+ case 'f':
+ f = 1;
+ break;
+ case 'r':
+ r = 1;
+ break;
+ case 'v':
+ v = 1;
+ break;
+ case '-':
+ break;
+ default:
+ rt_kprintf("Error: Bad option: %c\n", argv[1][n]);
+ return 0;
}
}
argc -= 1;
@@ -363,7 +370,7 @@ int cmd_rm(int argc, char **argv)
for (index = 1; index < argc; index ++)
{
struct stat s;
- if (stat (argv[index], &s) == 0)
+ if (stat(argv[index], &s) == 0)
{
if (s.st_mode & S_IFDIR)
{
@@ -469,8 +476,81 @@ int cmd_mkfs(int argc, char **argv)
}
FINSH_FUNCTION_EXPORT_ALIAS(cmd_mkfs, __cmd_mkfs, format disk with file system);
+extern struct dfs_filesystem filesystem_table[];
+int cmd_mount(int argc, char *argv[])
+{
+ if (argc == 1)
+ {
+ struct dfs_filesystem *iter;
+
+ /* display the mount history */
+ rt_kprintf("filesystem device mountpoint\n");
+ rt_kprintf("---------- ------ ----------\n");
+ for (iter = &filesystem_table[0];
+ iter < &filesystem_table[DFS_FILESYSTEMS_MAX]; iter++)
+ {
+ if ((iter != NULL) && (iter->path != NULL))
+ {
+ rt_kprintf("%-10s %-6s %-s\n",
+ iter->ops->name, iter->dev_id->parent.name, iter->path);
+ }
+ }
+ return 0;
+ }
+ else if (argc == 4)
+ {
+ char *device = argv[1];
+ char *path = argv[2];
+ char *fstype = argv[3];
+
+ /* mount a filesystem to the specified directory */
+ rt_kprintf("mount device %s(%s) onto %s ... ", device, fstype, path);
+ if (dfs_mount(device, path, fstype, 0, 0) == 0)
+ {
+ rt_kprintf("succeed!\n");
+ return 0;
+ }
+ else
+ {
+ rt_kprintf("failed!\n");
+ return -1;
+ }
+ }
+ else
+ {
+ rt_kprintf("Usage: mount .\n");
+ return -1;
+ }
+}
+FINSH_FUNCTION_EXPORT_ALIAS(cmd_mount, __cmd_mount, mount );
+
+/* unmount the filesystem from the specified mountpoint */
+int cmd_umount(int argc, char *argv[])
+{
+ char *path = argv[1];
+
+ if (argc != 2)
+ {
+ rt_kprintf("Usage: unmount .\n");
+ return -1;
+ }
+
+ rt_kprintf("unmount %s ... ", path);
+ if (dfs_unmount(path) < 0)
+ {
+ rt_kprintf("failed!\n");
+ return -1;
+ }
+ else
+ {
+ rt_kprintf("succeed!\n");
+ return 0;
+ }
+}
+FINSH_FUNCTION_EXPORT_ALIAS(cmd_umount, __cmd_umount, Unmount device from file system);
+
extern int df(const char *path);
-int cmd_df(int argc, char** argv)
+int cmd_df(int argc, char **argv)
{
if (argc != 2)
{
@@ -492,7 +572,7 @@ int cmd_df(int argc, char** argv)
}
FINSH_FUNCTION_EXPORT_ALIAS(cmd_df, __cmd_df, disk free);
-int cmd_echo(int argc, char** argv)
+int cmd_echo(int argc, char **argv)
{
if (argc == 2)
{
@@ -505,7 +585,7 @@ int cmd_echo(int argc, char** argv)
fd = open(argv[2], O_RDWR | O_APPEND | O_CREAT, 0);
if (fd >= 0)
{
- write (fd, argv[1], strlen(argv[1]));
+ write(fd, argv[1], strlen(argv[1]));
close(fd);
}
else
diff --git a/components/libc/compilers/common/time.c b/components/libc/compilers/common/time.c
index c2fbd6f333..ed72cc1f3f 100644
--- a/components/libc/compilers/common/time.c
+++ b/components/libc/compilers/common/time.c
@@ -12,7 +12,6 @@
* 2021-02-08 Meco Man add settimeofday() stime()
* 2021-02-10 Meco Man add ctime_r() and re-implement ctime()
* 2021-02-11 Meco Man fix bug #3183 - align days[] and months[] to 4 bytes
- * add difftime()
* 2021-02-12 Meco Man add errno
* 2012-12-08 Bernard fix the issue of _timevalue.tv_usec initialization,
* which found by Rob
@@ -177,12 +176,6 @@ char* ctime(const time_t *tim_p)
}
RTM_EXPORT(ctime);
-double difftime (time_t tim1, time_t tim2)
-{
- return (double)(tim1 - tim2);
-}
-RTM_EXPORT(difftime);
-
/**
* Returns the current time.
*
@@ -372,6 +365,10 @@ int settimeofday(const struct timeval *tv, const struct timezone *tz)
}
RTM_EXPORT(settimeofday);
+/* inherent in the toolchain */
+RTM_EXPORT(difftime);
+RTM_EXPORT(strftime);
+
#ifdef RT_USING_POSIX
static struct timeval _timevalue;
static int clock_time_system_init()
diff --git a/include/rtdef.h b/include/rtdef.h
index 0256601949..44328b5447 100644
--- a/include/rtdef.h
+++ b/include/rtdef.h
@@ -802,6 +802,9 @@ struct rt_memheap_item
struct rt_memheap_item *next_free; /**< next free memheap item */
struct rt_memheap_item *prev_free; /**< prev free memheap item */
+#ifdef RT_USING_MEMTRACE
+ rt_uint8_t owner_thread_name[4]; /**< owner thread name */
+#endif
};
/**
diff --git a/src/memheap.c b/src/memheap.c
index afa06fb9bf..449e66e975 100644
--- a/src/memheap.c
+++ b/src/memheap.c
@@ -85,6 +85,10 @@ rt_err_t rt_memheap_init(struct rt_memheap *memheap,
item->next_free = item;
item->prev_free = item;
+#ifdef RT_USING_MEMTRACE
+ rt_memset(item->owner_thread_name, ' ', sizeof(item->owner_thread_name));
+#endif
+
item->next = (struct rt_memheap_item *)
((rt_uint8_t *)item + memheap->available_size + RT_MEMHEAP_SIZE);
item->prev = item->next;
@@ -206,6 +210,10 @@ void *rt_memheap_alloc(struct rt_memheap *heap, rt_size_t size)
/* put the pool pointer into the new block. */
new_ptr->pool_ptr = heap;
+#ifdef RT_USING_MEMTRACE
+ rt_memset(new_ptr->owner_thread_name, ' ', sizeof(new_ptr->owner_thread_name));
+#endif
+
/* break down the block list */
new_ptr->prev = header_ptr;
new_ptr->next = header_ptr->next;
@@ -257,6 +265,13 @@ void *rt_memheap_alloc(struct rt_memheap *heap, rt_size_t size)
/* Mark the allocated block as not available. */
header_ptr->magic |= RT_MEMHEAP_USED;
+#ifdef RT_USING_MEMTRACE
+ if (rt_thread_self())
+ rt_memcpy(header_ptr->owner_thread_name, rt_thread_self()->name, sizeof(header_ptr->owner_thread_name));
+ else
+ rt_memcpy(header_ptr->owner_thread_name, "NONE", sizeof(header_ptr->owner_thread_name));
+#endif
+
/* release lock */
rt_sem_release(&(heap->lock));
@@ -381,6 +396,10 @@ void *rt_memheap_realloc(struct rt_memheap *heap, void *ptr, rt_size_t newsize)
/* put the pool pointer into the new block. */
next_ptr->pool_ptr = heap;
+#ifdef RT_USING_MEMTRACE
+ rt_memset(next_ptr->owner_thread_name, ' ', sizeof(next_ptr->owner_thread_name));
+#endif
+
next_ptr->prev = header_ptr;
next_ptr->next = header_ptr->next;
header_ptr->next->prev = next_ptr;
@@ -445,6 +464,10 @@ void *rt_memheap_realloc(struct rt_memheap *heap, void *ptr, rt_size_t newsize)
/* put the pool pointer into the new block. */
new_ptr->pool_ptr = heap;
+#ifdef RT_USING_MEMTRACE
+ rt_memset(new_ptr->owner_thread_name, ' ', sizeof(new_ptr->owner_thread_name));
+#endif
+
/* break down the block list */
new_ptr->prev = header_ptr;
new_ptr->next = header_ptr->next;
@@ -590,6 +613,10 @@ void rt_memheap_free(void *ptr)
header_ptr->next_free, header_ptr->prev_free));
}
+#ifdef RT_USING_MEMTRACE
+ rt_memset(header_ptr->owner_thread_name, ' ', sizeof(header_ptr->owner_thread_name));
+#endif
+
/* release lock */
rt_sem_release(&(heap->lock));
}
@@ -728,4 +755,78 @@ void rt_memory_info(rt_uint32_t *total,
#endif
-#endif
+#ifdef RT_USING_MEMTRACE
+
+void dump_used_memheap(struct rt_memheap *mh)
+{
+ struct rt_memheap_item *header_ptr;
+ rt_uint32_t block_size;
+
+
+ rt_kprintf("\nmemory heap address:\n");
+ rt_kprintf("heap_ptr: 0x%08x\n", mh->start_addr);
+ rt_kprintf("free : 0x%08x\n", mh->available_size);
+ rt_kprintf("max_used: 0x%08x\n", mh->max_used_size);
+ rt_kprintf("size : 0x%08x\n", mh->pool_size);
+
+ rt_kprintf("\n--memory used information --\n");
+
+ header_ptr = mh->block_list;
+ while (header_ptr->next != mh->block_list)
+ {
+ if ((header_ptr->magic & RT_MEMHEAP_MASK) != RT_MEMHEAP_MAGIC)
+ {
+ rt_kprintf("[0x%08x - incorrect magic: 0x%08x\n", header_ptr, header_ptr->magic);
+ break;
+ }
+
+ /* get current memory block size */
+ block_size = MEMITEM_SIZE(header_ptr);
+ if (block_size < 0)
+ break;
+
+ if (RT_MEMHEAP_IS_USED(header_ptr))
+ {
+ /* dump information */
+ rt_kprintf("[0x%08x - %d - %c%c%c%c] used\n", header_ptr, block_size,
+ header_ptr->owner_thread_name[0], header_ptr->owner_thread_name[1],
+ header_ptr->owner_thread_name[2], header_ptr->owner_thread_name[3]);
+ }
+ else
+ {
+ /* dump information */
+ rt_kprintf("[0x%08x - %d - %c%c%c%c] free\n", header_ptr, block_size,
+ header_ptr->owner_thread_name[0], header_ptr->owner_thread_name[1],
+ header_ptr->owner_thread_name[2], header_ptr->owner_thread_name[3]);
+ }
+
+ /* move to next used memory block */
+ header_ptr = header_ptr->next;
+ }
+}
+
+void memtrace_heap()
+{
+ struct rt_object_information *info;
+ struct rt_list_node *list;
+ struct rt_memheap *mh;
+ struct rt_list_node *node;
+
+ info = rt_object_get_information(RT_Object_Class_MemHeap);
+ list = &info->object_list;
+
+ for (node = list->next; node != list; node = node->next)
+ {
+ mh = (struct rt_memheap *)rt_list_entry(node, struct rt_object, list);
+ dump_used_memheap(mh);
+ }
+}
+
+#ifdef RT_USING_FINSH
+#include
+MSH_CMD_EXPORT(memtrace_heap, dump memory trace for heap);
+#endif /* end of RT_USING_FINSH */
+
+#endif /* end of RT_USING_MEMTRACE */
+
+#endif /* end of RT_USING_MEMHEAP */
diff --git a/tools/building.py b/tools/building.py
index ba995af278..00a9f04107 100644
--- a/tools/building.py
+++ b/tools/building.py
@@ -626,6 +626,8 @@ def DefineGroup(name, src, depend, **parameters):
group['name'] = name
group['path'] = group_path
if type(src) == type([]):
+ # remove duplicate elements from list
+ src = list(set(src))
group['src'] = File(src)
else:
group['src'] = src