gen/bin/examples/blink.bin
,gen/bin/examples/hello_world.bin
, and so on.boot.s
is first in linking order is important.You don't need to worry about that for these examples, because the makefiletakes care of all that, but once you start building your own programs you'llneed to be careful.Error: Could not initialize the debug port
instead, that's a signthat's something is wrong with the connection. Check your wiring, and if that'sokay make sure that you have the correct pins on your Pi hooked up.reset halt
command, which means restart the CPU and then stopbefore executing any instructions.flash write_image erase gen/bin/examples/blink.bin 0x08000000
. This is tellingOpenOCD to write the data in the file, starting at address 0x08000000
, whichis where flash is mapped to on the Blue Pill.openocd
command was run from thestm32_bare_lib source folder.reset
command, which with no arguments restarts the chip and begins execution.DebugLog()
to do this. To run it, execute these commands in the OpenOCD command console:openocd
commandin (not the console you just used), you should see the line 'Hello World!' atthe bottom.DebugLog()
function can take several hundred milliseconds to execute,since it has to call back to the host machine, so it shouldn't be used inperformance-critical code, but it is handy when you're trying to track downissues.gdb
works reasonably well with this setup. Toinstall it, run:-T stm32_linker_layout.lds
, so the linker knows where programand data memory start on the Blue Pill.main()
function, provide OnReset()
. This is called when thechip starts up.OnReset()
call.core_cm3.h
.It can't be called without some extra definitions beforehand though, sostm32_bare_lib'score_stm32.h
header handles setting those up for the Blue Pill.core_stm32.h
header includes a few of the most commonly-used device registers, as defined byST's reference guide to the processor.These definitions are used to set up and control the LEDs for example.renode/test_hello_world.sh
script on any machine with Docker and Bash installed. This calls aDockerfilethat installs Renode and its dependencies into an Ubuntu 16.04 virtual machine,and then builds and runsthe hello world examplein that environment. It then examines the log output, and checks that theexpected debug log message has been output, returning success if it has.DebugLog()
calls.docker run -v
commandabove and then start the renode process by running:[Monitor]
prompt in the second window.This will allow you to runthe full set of Renode commandsto load and run microcontroller executables.