PulkoMandy | 58ea04f | 2021-09-20 22:57:30 +0200 | [diff] [blame^] | 1 | /* printf in "CLib" will call printf_hook. |
| 2 | _SemiPrintf makes IDE can hook "printf" action. |
| 3 | User don't want to hook "printf" when __OPTIMIZE__. |
| 4 | function prototype: |
| 5 | void printf_hook (unsigned long lptr, unsigned int size); */ |
| 6 | #ifndef __OPTIMIZE__ |
| 7 | asm (".code |
| 8 | .public _SemiPrintf |
| 9 | .public _printf_hook |
| 10 | _printf_hook: .proc |
| 11 | _SemiPrintf: |
| 12 | retf |
| 13 | .endp |
| 14 | "); |
| 15 | #else |
| 16 | asm (".code |
| 17 | .public _printf_hook |
| 18 | _printf_hook: .proc |
| 19 | retf |
| 20 | .endp |
| 21 | "); |
| 22 | #endif |
| 23 | |
| 24 | /* Be compatible with old project, user can remove them in new project. */ |
| 25 | void printf_init (int x) |
| 26 | { |
| 27 | return; |
| 28 | } |
| 29 | void printf_end (void) |
| 30 | { |
| 31 | return; |
| 32 | } |
| 33 | |
| 34 | /* printf in "CLib" will call putchar. |
| 35 | user can implement this function -- send a char to UART? */ |
| 36 | int putchar (int c) |
| 37 | { |
| 38 | return c; |
| 39 | } |
| 40 | |
| 41 | /* malloc in "LibMem" will call malloc_lock/malloc_unlock. |
| 42 | if user's project has multitask, they should be implemented. */ |
| 43 | void _malloc_lock (void) |
| 44 | { |
| 45 | return; |
| 46 | } |
| 47 | void _malloc_unlock (void) |
| 48 | { |
| 49 | return; |
| 50 | } |