cpq / bare-metal-programming-guide

A bare metal programming guide (ARM microcontrollers)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

No mention of `_sbrk` implementation in "Redirect printf() to UART" section

tysonliddell opened this issue · comments

printf in newlib-nano makes a call to malloc and thus requires _sbrk to be implemented for it to work. I learned this the hard way when trying to complete the "Redirect printf() to UART" section on a TM4C123GH6PM. Calls to printf sent nothing but empty strings to the _write syscall when _sbrk was not implemented. _sbrk is implemented in your linked solution at the end of the chapter; however, it would be helpful to mention in your explanation that both _write and _sbrk need to be implemented.