重写BSP

This commit is contained in:
2025-07-25 21:27:22 +08:00
parent 957efa64ab
commit d963759f90
10 changed files with 300 additions and 295 deletions

View File

@@ -315,7 +315,7 @@
</ArmAdsMisc>
<Cads>
<interw>1</interw>
<Optim>2</Optim>
<Optim>1</Optim>
<oTime>0</oTime>
<SplitLS>0</SplitLS>
<OneElfS>1</OneElfS>
@@ -338,10 +338,10 @@
<v6WtE>0</v6WtE>
<v6Rtti>0</v6Rtti>
<VariousControls>
<MiscControls></MiscControls>
<MiscControls>--no-multibyte-chars</MiscControls>
<Define>USE_STDPERIPH_DRIVER,STM32F10X_HD,DEBUG,</Define>
<Undefine></Undefine>
<IncludePath>..\..\..\Bsp\Inc;..\..\..\System;..\..\..\System\CMSIS;..\..\..\ThirdLib\LetterShell\Inc;..\..\..\StdLib\Inc;..\App\Inc;..\..\..\ThirdLib\ThreadX\common\inc;..\..\..\ThirdLib\ThreadX\ports\cortex_m3\keil\inc</IncludePath>
<IncludePath>..\..\..\Bsp\Inc;..\..\..\System;..\..\..\System\CMSIS;..\..\..\ThirdLib\LetterShell\Inc;..\..\..\StdLib\Inc;..\App\Inc;..\..\..\ThirdLib\ThreadX\common\inc;..\..\..\ThirdLib\ThreadX\ports\cortex_m3\keil\inc;..\App\Board</IncludePath>
</VariousControls>
</Cads>
<Aads>
@@ -386,9 +386,9 @@
<GroupName>App</GroupName>
<Files>
<File>
<FileName>LetterShell.c</FileName>
<FileName>Main.c</FileName>
<FileType>1</FileType>
<FilePath>..\App\Src\LetterShell.c</FilePath>
<FilePath>..\App\Src\Main.c</FilePath>
</File>
<File>
<FileName>LedTest.c</FileName>
@@ -396,9 +396,9 @@
<FilePath>..\App\Src\LedTest.c</FilePath>
</File>
<File>
<FileName>Main.c</FileName>
<FileName>LetterShell.c</FileName>
<FileType>1</FileType>
<FilePath>..\App\Src\Main.c</FilePath>
<FilePath>..\App\Src\LetterShell.c</FilePath>
</File>
</Files>
</Group>
@@ -1962,9 +1962,9 @@
<GroupName>App</GroupName>
<Files>
<File>
<FileName>LetterShell.c</FileName>
<FileName>Main.c</FileName>
<FileType>1</FileType>
<FilePath>..\App\Src\LetterShell.c</FilePath>
<FilePath>..\App\Src\Main.c</FilePath>
</File>
<File>
<FileName>LedTest.c</FileName>
@@ -1972,9 +1972,9 @@
<FilePath>..\App\Src\LedTest.c</FilePath>
</File>
<File>
<FileName>Main.c</FileName>
<FileName>LetterShell.c</FileName>
<FileType>1</FileType>
<FilePath>..\App\Src\Main.c</FilePath>
<FilePath>..\App\Src\LetterShell.c</FilePath>
</File>
</Files>
</Group>

View File

@@ -1,121 +0,0 @@
IMPORT _tx_thread_system_stack_ptr
IMPORT _tx_initialize_unused_memory
IMPORT _tx_timer_interrupt
IMPORT __main
IMPORT __initial_sp
IMPORT __Vectors
SYSTEM_CLOCK EQU 72000000
SYSTICK_CYCLES EQU ((SYSTEM_CLOCK / 1000) -1)
AREA ||.text||, CODE, READONLY
;VOID _tx_initialize_low_level(VOID)
;{
EXPORT _tx_initialize_low_level
_tx_initialize_low_level
;
; /* Disable interrupts during ThreadX initialization. */
;
CPSID i
;
; /* Set base of available memory to end of non-initialised RAM area. */
;
LDR r0, =_tx_initialize_unused_memory ; Build address of unused memory pointer
LDR r1, =__initial_sp ; Build first free address
ADD r1, r1, #4 ;
STR r1, [r0] ; Setup first unused memory pointer
;
; /* Setup Vector Table Offset Register. */
;
MOV r0, #0xE000E000 ; Build address of NVIC registers
LDR r1, =__Vectors ; Pickup address of vector table
STR r1, [r0, #0xD08] ; Set vector table address
;
; /* Enable the cycle count register. */
;
; LDR r0, =0xE0001000 ; Build address of DWT register
; LDR r1, [r0] ; Pickup the current value
; ORR r1, r1, #1 ; Set the CYCCNTENA bit
; STR r1, [r0] ; Enable the cycle count register
;
; /* Set system stack pointer from vector value. */
;
LDR r0, =_tx_thread_system_stack_ptr ; Build address of system stack pointer
LDR r1, =__Vectors ; Pickup address of vector table
LDR r1, [r1] ; Pickup reset stack pointer
STR r1, [r0] ; Save system stack pointer
;
; /* Configure SysTick for 100Hz clock, or 16384 cycles if no reference. */
;
MOV r0, #0xE000E000 ; Build address of NVIC registers
LDR r1, =SYSTICK_CYCLES
STR r1, [r0, #0x14] ; Setup SysTick Reload Value
MOV r1, #0x7 ; Build SysTick Control Enable Value
STR r1, [r0, #0x10] ; Setup SysTick Control
;
; /* Configure handler priorities. */
;
LDR r1, =0x00000000 ; Rsrv, UsgF, BusF, MemM
STR r1, [r0, #0xD18] ; Setup System Handlers 4-7 Priority Registers
LDR r1, =0xFF000000 ; SVCl, Rsrv, Rsrv, Rsrv
STR r1, [r0, #0xD1C] ; Setup System Handlers 8-11 Priority Registers
; Note: SVC must be lowest priority, which is 0xFF
LDR r1, =0x40FF0000 ; SysT, PnSV, Rsrv, DbgM
STR r1, [r0, #0xD20] ; Setup System Handlers 12-15 Priority Registers
; Note: PnSV must be lowest priority, which is 0xFF
;
; /* Return to caller. */
;
BX lr
;}
;/* Define shells for each of the unused vectors. */
;
EXPORT __tx_BadHandler
__tx_BadHandler
B __tx_BadHandler
EXPORT __tx_SVCallHandler
__tx_SVCallHandler
B __tx_SVCallHandler
EXPORT __tx_IntHandler
__tx_IntHandler
; VOID InterruptHandler (VOID)
; {
PUSH {r0, lr}
; /* Do interrupt handler work here */
; /* .... */
POP {r0, lr}
BX LR
; }
EXPORT __tx_SysTickHandler
EXPORT SysTick_Handler
__tx_SysTickHandler
SysTick_Handler
; VOID TimerInterruptHandler (VOID)
; {
;
PUSH {r0, lr}
BL _tx_timer_interrupt
POP {r0, lr}
BX LR
; }
EXPORT __tx_NMIHandler
__tx_NMIHandler
B __tx_NMIHandler
EXPORT __tx_DBGHandler
__tx_DBGHandler
B __tx_DBGHandler
ALIGN
LTORG
END