During all the training we are going to focus on preparing your skills to know several features of the microcontrollers like gpio, timers, uart, interrupts and etc. It is important to know the resources and more important to know the target, in this case, will be the ST stm32g0b1re, a 32bit microcontroller with an ARM Cortex-M0+ core, do not forget to download the following documentation: datasheet and reference manual
Prior to anything you will need to read and install the tools from the way we work
The template
For every newbie, the best way to start is through a working out-of-the-box project. Here is my advice, create a specific directory where you gonna put all your projects, and be disciplined with all the projects you create, the last thing you want is to have directories all over your computer. For instance:
$ mkdir Workspace
$ cd Workspace
$ git clone https://github.com/ModularMX/template-g0.git myNewProject
$ code -r myNewProject
The template is basically a simple blinky led, the hello world of microcontrollers, to flash and run the program type ( do not forget the terminal shall be in your project directory ). This is the project base you will use for every program you make across the entire training.
$ make
....
arm-none-eabi-objcopy -Oihex Build/temp.elf Build/temp.hex
arm-none-eabi-objdump -S Build/temp.elf > Build/temp.lst
arm-none-eabi-size --format=berkeley Build/temp.elf
text data bss dec hex filename
2244 20 1572 3836 efc Build/temp.elf
Connect and flash your board
$ make flash
openocd -f board/st_nucleo_g0.cfg -c "program Build/temp.hex verify reset" -c shutdown
Open On-Chip Debugger 0.11.0+dev-00715-g480d4e177-dirty (2022-06-22-18:51)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD
srst_only separate srst_nogate srst_open_drain connect_deassert_srst
Info : clock speed 2000 kHz
Info : STLINK V2J40M27 (API v2) VID:PID 0483:374B
Info : Target voltage: 3.253088
Info : [stm32g0x.cpu] Cortex-M0+ r0p1 processor detected
Info : [stm32g0x.cpu] target has 4 breakpoints, 2 watchpoints
Info : starting gdb server for stm32g0x.cpu on 3333
Info : Listening on port 3333 for gdb connections
Info : Unable to match requested speed 2000 kHz, using 1800 kHz
Info : Unable to match requested speed 2000 kHz, using 1800 kHz
target halted due to debug-request, current mode: Thread
xPSR: 0xf1000000 pc: 0x0800023c msp: 0x20024000
** Programming Started **
Info : device idcode = 0x10006467 (STM32G0B/G0Cx - Rev A : 0x1000)
Info : RDP level 0 (0xAA)
Info : flash size = 512kbytes
Info : flash mode : dual-bank
Warn : Adding extra erase range, 0x080008d8 .. 0x08000fff
** Programming Finished **
** Verify Started **
** Verified OK **
** Resetting Target **
Info : Unable to match requested speed 2000 kHz, using 1800 kHz
Info : Unable to match requested speed 2000 kHz, using 1800 kHz
shutdown command invoked.
Enjoy watching your led blinking, and if you want to know more about all the target you can use with the project makefile take a look at
An here is a nice video introduction from ST