Add abort() implementation
Also reduces the IRAM footprint of the fatal exception handler, as only the prelude (which disables interrupts & enables the flash mapping) is in IRAM now. Closes #54, relevant to #133.
This commit is contained in:
		
							parent
							
								
									cf350efd8a
								
							
						
					
					
						commit
						36886412e6
					
				
					 9 changed files with 106 additions and 33 deletions
				
			
		|  | @ -17,13 +17,6 @@ void dump_stack(uint32_t *sp); | |||
| 
 | ||||
|    Probably not useful to be called in other contexts. | ||||
| */ | ||||
| void fatal_exception_handler(uint32_t *sp); | ||||
| 
 | ||||
| /* Dump the current exception register state.
 | ||||
| 
 | ||||
|    Probably mostly useful when called from fatal exception handler. | ||||
| */ | ||||
| void dump_excinfo(void); | ||||
| 
 | ||||
| void __attribute__((noreturn)) fatal_exception_handler(uint32_t *sp); | ||||
| 
 | ||||
| #endif | ||||
|  |  | |||
|  | @ -14,6 +14,20 @@ | |||
| // GCC macros for reading, writing, and exchanging Xtensa processor special
 | ||||
| // registers:
 | ||||
| 
 | ||||
| /* Read stack pointer to variable.
 | ||||
|  * | ||||
|  * Note that the compiler will push a stack frame (minimum 16 bytes) | ||||
|  * in the prelude of a C function that calls any other functions. | ||||
|  */ | ||||
| #define SP(var) asm volatile ("mov %0, a1" : "=r" (var)); | ||||
| 
 | ||||
| /* Read the function return address to a variable.
 | ||||
|  * | ||||
|  * Depends on the containing function being simple enough that a0 is | ||||
|  * being used as a working register. | ||||
|  */ | ||||
| #define RETADDR(var) asm volatile ("mov %0, a0" : "=r" (var)) | ||||
| 
 | ||||
| #define RSR(var, reg) asm volatile ("rsr %0, " #reg : "=r" (var)); | ||||
| #define WSR(var, reg) asm volatile ("wsr %0, " #reg : : "r" (var)); | ||||
| #define XSR(var, reg) asm volatile ("xsr %0, " #reg : "+r" (var)); | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue