2016-07-28 12:19 PM
I'm new to arm programming, I'm teaching myself with the STM32 specifically the STM32F030x6.
To start myself off with any new mcu arch, I write a simple as ever code that would make one of the gpio pins go high to confirm it's working.
Though trying the following code doesn't seem to work, any ideas?
.text
start:
ldr r1, RCC
ldr r2, AHB
str r2, [r1,#0x14]
ldr r1, GPIOA
ldr r2, MODER
ldr r3, ODR
str r2, [r1,#0x0]
str r3, [r1,#0x14]
stop: b stop
.align
RCC: .word 0x40021000
AHB: .word 0x00020000
GPIOA: .word 0x48000000
MODER: .word 0x00000005
ODR: .word 0x00000003
I'm using the stlinkV2 if that helps.
Edit: forgot mention I'm using the gnu assembler #stm32-gpio2016-07-28 01:14 PM
1. Why assembler? At this day is ways of time. need to be maniac to use asembler on Cortex.
2. Read erratas. 1 for core, second for chosen MCU. After enabling peripheral clock you need to wait before acces to this peripheral registers. Dummy read from RCC will be correct (more precise than this in errata). There is a restriction for LDR STR in errata,....2016-07-28 01:45 PM
I don't plan on using assembly for major projects. I use asm as a way to introduce myself to new chips to better understand the arch and have the knowledge to deal with any optimization issues I might come across.
And thanks for the info I'll look into the errata2016-07-28 01:50 PM
Most off cortex M programist don't have any knowlege about architecture and they have many success in this matter.
In C but clean C not in libraries like SPL or HAL, you will enought learn architecture.