I have written the following assembly program. It compiles without errors, but I get this warning:
FirstTest.sct(8): warning: L6314W: No section matches pattern *(InRoot$$Sections).
The purpose of the program is to simply light up two of four LEDs on a development board (Open103R). Program:
; ; First lab assembly program ; Written by Kelly Hathaway ; GPIOC_CRL EQU 0x40011000 GPIOC_CRH EQU 0x40011004 GPIOC_IDR EQU 0x40011008 GPIOC_ODR EQU 0x4001100C GPIOC_BSRR EQU 0x40011010 GPIOC_BRR EQU 0x40011014 GPIOC_LCKR EQU 0x40011018 AREA RESET, CODE, READONLY ENTRY start MOV32 r1, #GPIOC_CRH ; Address for port c control register MOV32 r0, #0x00033330 ; Value for control register STR r0, [r1] ; Write to contorl register MOV32 r1, #GPIOC_ODR ; Address for port c output data register MOV r0, #0x0A00 ; Value for port c STR r0, [r1] ; Write value loop B loop END
When I simulate this code in the Keil simulator the execution begins at 0x0101F2C4 and not 0x0. The disassembly window shows the code is in fact at 0x0. How do I get the code to execute starting at 0x0? When I step, I get this error:
*** error 65: access violation at 0x0104F238 : no 'write' permission.
Can anyone help me understand what I am missing? I have search around other threads and online forums, but cannot figure out what is wrong.
Thanks
Issue solved. For this device, the first two words at 0x0 are the initial stack pointer value and the initial program counter value. The program counter loads the value at 0x4 and then executes.
I think you'll find that's for any Cortex-M3 device.
my.st.com/.../Flat.aspx