之前已经完成了基本的编译工作。
今天早上开始写了几个基本的设备驱动,同时编写了两个简单的测试任务。其间出现几个问题。
第一个问题是代码编译能通过,但是下载到板子上就是跑不动,根本运行不到main函数,估计是初始化系统部分存在一些问题,我也没有深入研究直接将stm32官方的stm32f10x_vector.s和现在的init.s整合得到以下的系统初始化代码,该代码能够保证测试任务LED流水灯正常运行。
; If you need to use external SRAM mounted on STM3210E-EVAL board as data memory,
; change the following define value to '1' (or choose ENABLE in Configuration Wizard window)
;// <o> External SRAM Configuration <0=> DISABLE <1=> ENABLE
DATA_IN_ExtSRAM EQU 0
; Amount of memory (in bytes) allocated for Stack
; Tailor this value to your application needs
;// <h> Stack Configuration
;// <o> Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
;// </h>
Stack_Size EQU 0x00000400
AREA STACK, NOINIT, READWRITE, ALIGN=3
Stack_Mem SPACE Stack_Size
__initial_sp
; If you need to use external SRAM mounted on STM3210E-EVAL board as data memory
; and internal SRAM for Stack, uncomment the following line and comment the line above
;__initial_sp EQU 0x20000000 + Stack_Size ; "Use MicroLIB" must be checked in
; the Project->Options->Target window
; Amount of memory (in bytes) allocated for Heap
; Tailor this value to your application needs
;// <h> Heap Configuration
;// <o> Heap Size (in Bytes) <0x0-0xFFFFFFFF:8>
;// </h>
Heap_Size EQU 0x00000100
AREA HEAP, NOINIT, READWRITE, ALIGN=3
__heap_base
Heap_Mem SPACE Heap_Size
__heap_limit
THUMB
PRESERVE8
; Import exceptions handlers
IMPORT OS_CPU_SysTickHandler
IMPORT OS_CPU_PendSVHandler
;*******************************************************************************
; Fill-up the Vector Table entries with the exceptions ISR address
;*******************************************************************************
AREA RESET, DATA, READONLY
EXPORT __Vectors
__Vectors
DCD __initial_sp ; 0, SP start value.
DCD Reset_Handler ; 1, PC start value.
DCD App_NMI_ISR ; 2, NMI
DCD App_Fault_ISR ; 3, Hard Fault
DCD App_Spurious_ISR ;
今天早上开始写了几个基本的设备驱动,同时编写了两个简单的测试任务。其间出现几个问题。
第一个问题是代码编译能通过,但是下载到板子上就是跑不动,根本运行不到main函数,估计是初始化系统部分存在一些问题,我也没有深入研究直接将stm32官方的stm32f10x_vector.s和现在的init.s整合得到以下的系统初始化代码,该代码能够保证测试任务LED流水灯正常运行。
; If you need to use external SRAM mounted on STM3210E-EVAL board as data memory,
; change the following define value to '1' (or choose ENABLE in Configuration Wizard window)
;// <o> External SRAM Configuration <0=> DISABLE <1=> ENABLE
DATA_IN_ExtSRAM EQU 0
; Amount of memory (in bytes) allocated for Stack
; Tailor this value to your application needs
;// <h> Stack Configuration
;// <o> Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
;// </h>
Stack_Size EQU 0x00000400
AREA STACK, NOINIT, READWRITE, ALIGN=3
Stack_Mem SPACE Stack_Size
__initial_sp
; If you need to use external SRAM mounted on STM3210E-EVAL board as data memory
; and internal SRAM for Stack, uncomment the following line and comment the line above
;__initial_sp EQU 0x20000000 + Stack_Size ; "Use MicroLIB" must be checked in
; the Project->Options->Target window
; Amount of memory (in bytes) allocated for Heap
; Tailor this value to your application needs
;// <h> Heap Configuration
;// <o> Heap Size (in Bytes) <0x0-0xFFFFFFFF:8>
;// </h>
Heap_Size EQU 0x00000100
AREA HEAP, NOINIT, READWRITE, ALIGN=3
__heap_base
Heap_Mem SPACE Heap_Size
__heap_limit
THUMB
PRESERVE8
; Import exceptions handlers
IMPORT OS_CPU_SysTickHandler
IMPORT OS_CPU_PendSVHandler
;*******************************************************************************
; Fill-up the Vector Table entries with the exceptions ISR address
;*******************************************************************************
AREA RESET, DATA, READONLY
EXPORT __Vectors
__Vectors
DCD __initial_sp ; 0, SP start value.
DCD Reset_Handler ; 1, PC start value.
DCD App_NMI_ISR ; 2, NMI
DCD App_Fault_ISR ; 3, Hard Fault
DCD App_Spurious_ISR ;