Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upets_printf may not be safe for ISR debug printing #6529
Comments
|
@mhightower83, what do you suggest to resolve this? A documentation addition? I don't think any of the core routines themselves (other than maybe your cool new umm stuff when called by an evil IRQ to allocate memory) try and print stuff in an ISR... |
|
@mhightower83 I'm not sure I understand the use case either. Are there ISRs somewhere in our core or in the sdk that are printing out with unsafe functions? |
|
@devyte the later. What I noticed when I searched for a safe printf function to use for debugging from an ISR (or rsil(15)), was Also worth noting is that In the printout, I was trying to show the changes in the So my conclusion was that for debugging purposes Update: Improved wording |
Basic Infos
Platform
Settings in IDE
Problem Description
I have seen in several places where
ets_printf()is the recommended function call for debug printing from an ISR; however, from what I see in the current master I don't think this is true anymore.ets_printf()uses the character print function installed byets_install_putc1(). At the start ofsetup()the print function address resides in IRAM. OnceSerial.begin()is called that print function address resides in flash. The MCVE below shows the function address under various situations and the resulting output across Serial and Serial1.It looks to me that of these options, the safest ISR debug print solution is to use
ets_uart_printf()and/orets_putc(). Both of these functions reside in ROM and neither uses the print function installed byets_install_putc1(). They use an internal ROM function for printing, which requires a prior call touart_buff_switch()to select a UART.MCVE Sketch
Debug Messages
From Serial
From Serial1