Content
@
0 reply
0 recast
0 reaction
July
@july
*cries in embedded*
2 replies
2 recasts
24 reactions
July
@july
The reason is because printf includes support for a bunch of stuff that increases its memory footprint and where memory and processing power are a premium that can't easily be found, printf sometimes isn't an option oh also, if you printf on MCUs, it goes nowhere lol. you have to send that over UART or some protocol, so now you need a UART driver and UART available to begin with. same goes w/ I2C, etc etc
1 reply
1 recast
6 reactions
Anuraj R
@anurajenp
printf can be used in this use case too 😉 I have done this. F103 is cortexm3 I guess. What you need to do is first write a custom printf without all the garbage in newlib nano c library which you are probably linking to if you are using gcc. Then you can retarget it to uart. You would also need a custom hardfault handler and start up code to initialize the UART registers during startup before main. There are cases where you can’t use debuggers because in the finished product you generally disable the jtag/swd port and then you can’t debug the system with a debuggers. So you need some way to get the stack trace when a fault happens.
0 reply
0 recast
3 reactions