Skip to content

ChuckM/nucleo-retarget-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Nucleo Retargeting Example

As the Nucleo boards provide access to one of the STM32's USARTS (usually USART2) on their debug connector, this example shows you how to 'hook it' into the C library provided in the gcc-arm-embedded toolchain so that you can use printf and friends to talk to your board from your C code.

Add the object retarget.o to the OBJ files and it will add a constructor function (SystemInit()) which will run before main is started. That function initializes the system clock, the UART that is connected to the Debug portion of the Nucleo board, and a 1kHz system "tick" interrupt (which is useful for timing etc).

The main.c code simply prints out some numbers and creates a simple interactive dialog over the UART "console".

There are two board files now, one for the NUCLEO-F030R8 and one for the NUCLEO-F411RE which differ by processor of course. The retarget file is also updated to use scb_reset_system which more reliably resets the board than hacking the stack does.

NB: As of this edit (12/12/14) you will need my additions to LOC3 to run this on the F0 or L0 Nucleo boards.

About

Retargeting libc to the Nucleo debug port and libopencm3

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors