Question
Can't acess peripheral memory with normal load/store instructions
Posted on August 11, 2012 at 10:32
Hey guys, does someone knows why access to peripheral memory location (0x40000000 - 0x5FFFFFFF) can't be done with normal LDR and STR instructions. It works fine in simulation but when flashed in the chip, the memory accesses are bypassed (can't modify bits) in a peripheral register. Here's a simple example written in Keil where I attempt to access a GPIO register in modify the bits. The target is STM32F407VG
________________________________________________________STACK_TOP EQU 0x20000400 ; Top of the stack adress
GPIO_TOP EQU 0x40020000 ; Start adresse of GPIO-D in stm32f407VGAREA Reset, CODE, READONLY
__Vector_Table DCD STACK_TOP ;0x00 DCD Reset_Handler ;0x04 ENTRY Reset_Handler LDR r0, =GPIO_TOP MOV r1, &sharp0x55555555 ; configuration to make the pins in outpout mode STR r1, [r0] ; attempt to write to register...works in simulation not when flashed in the chip stop B stop END #gpio-rcc