Notes (to capture the discord discussion) on new user, hello world

So after getting the tools and the stm32f4 bsp built, I went on to do the hello world example. Personally I’m a big fan of make(1) but using waf per the quickstart guide. Because I was reading the PDF and typing in the stuff into my xterm window, the first thing that broke was I missed the def options(opt): line. That gave me the unhelpful message:

hello$ ./waf configure \
 --rtems=$HOME/.local/rtems/7/ \
 --rtems-tools=$HOME/.local/rtems/7/ \
 --rtems-bsp=arm/stm32f4
waf: error: no such option: --rtems

Once that was fixed, waf ran, but the build failed because it couldn’t locate condefs.h in my init.c code. That too was a typo, should be confdefs.h the ‘f’ being very important. :smile:

Okay, it builds! Yay. Now trying to test it out on an STM32F469i-Discovery board I used arm-rtems7-gdb build/arm-rtems7-stm32f4/hello.exe connected to openocd(1) with target extended-remote :3333 and load and run. All good.

Except, in a screen session that was looking at the serial port that is used for the consol. Lots of random characters, not actually text. Seems to be a baud rate issue, 115200 was my first guess, that didn’t work so I start walking up from 9600, 38400, 57600 … and that works, yay.

So, achievement unlocked, first RTEMS program written, built, and run.
–Chuck

1 Like

And I spoke a bit too soon, the program is loading at 0x0 rather than 0x08000000. So I’m going to have to figure that out.
–Chuck

So here’s the deal, in the stm32f4 bsp there is a linkcmds.stm32f4 which has the wrong flash address (its 0x00000000 and should be 0x08000000). But while I was looking there I saw link commands for other variants so created on for the STM32F469N. This bad boy has 2MB of flash and 384K of RAM.

So presumably I can rebuild the BSP now that I’ve added this file, but how do I tell waf that I want this variant? And do I need to rebuild the BSP or can I just copy the linkcmds file into my tree where RSB installed the others? Will it see it?

–Chuck

Can you adjust the memory map using BSP options?

./waf --rtems-bsps=arm/stm32f4 bspdefaults

Hmm, I can see STM32F4_LINKCMDS but I cannot see any memory map arguments.

If these variants are just memory map changes maybe making the BSP support options would be a simpler outcome?

Haven’t quite figured out how to create BSP support options in a BSP. The stm32f4 bsp is kind of skeleton (not too surprising). That said, all of the F4xx series all put FLASH at 0x08000000 and some RAM at 0x20000000 Because of the AMBA memory bus architecture there are different RAM chunks which have different properties. For example, CCM “Core Coupled Memory” can talk to the processor and has zero wait states but the DMA engine can’t talk to it. Also some times there are RAM segments that are preserved in sleep and others which aren’t.