Other Parts Discussed in Thread: HALCOGEN
Tool/software:
Hi!
I'm trying to implement a code that uses the sprintf() function to print data to a char. When using a formatted input (i.e.: "... %u ..."), the execution of the code stops running. If the code is paused at this idle stage, the HL_sys_intvecs.asm opens at a line that reads:
b dataEntry.
Doing a step by step debug, I've noticed that the interrupt is triggered inside the _pproc_fwp() function in the _printfi.c file, when trying to do the assignment
*tmpptr = '\0';(line 559 in my case).
My suspicion is that it could be related to the way I've configured the memory sections in the HL_sys_link.cmd file, as I'm not confident with what I did:
/* */ /*----------------------------------------------------------------------------*/ /* USER CODE BEGIN (0) */ /* USER CODE END */ /*----------------------------------------------------------------------------*/ /* Linker Settings */ --retain="*(.intvecs)" /* USER CODE BEGIN (1) */ /* USER CODE END */ /*----------------------------------------------------------------------------*/ /* Memory Map */ MEMORY { VECTORS (X) : origin=0x00000000 length=0x00000020 KERNEL (RX) : origin=0x00000020 length=0x00008000 FLASH0 (RX) : origin=0x00008020 length=0x001F7FE0 FLASH1 (RX) : origin=0x00200000 length=0x00200000 STACKS (RW) : origin=0x08000000 length=0x00000800 KRAM (RW) : origin=0x08000800 length=0x00000800 RAM (RW) : origin=(0x08000800+0x00000800) length=(0x0007f800 - 0x00000800) /* USER CODE BEGIN (2) */ /* USER CODE END */ } /* USER CODE BEGIN (3) */ /* USER CODE END */ /*----------------------------------------------------------------------------*/ /* Section Configuration */ SECTIONS { .intvecs : {} > VECTORS /* FreeRTOS Kernel in protected region of Flash */ .kernelTEXT align(32) : {} > KERNEL .cinit align(32) : {} > KERNEL .pinit align(32) : {} > KERNEL /* Rest of code to user mode flash region */ .text align(32) : {} > FLASH0 | FLASH1 .const align(32) : {} > FLASH0 | FLASH1 /* FreeRTOS Kernel data in protected region of RAM */ .kernelBSS : {} > KRAM .kernelHEAP : {} > RAM .bss : {} > RAM .data : {} > RAM /* USER CODE BEGIN (4) */ .sysmem : {} > RAM .freertosStaticStack : {} > RAM .noinit : {} > RAM /* USER CODE END */ } /* USER CODE BEGIN (5) */ /* USER CODE END */ /*----------------------------------------------------------------------------*/ /* Misc */ /* USER CODE BEGIN (6) */ /* USER CODE END */ /*----------------------------------------------------------------------------*/
The code that I'm running is a simple sprintf example:
uint8_t i = 2; char buffer[50]; int a = 10, b = 20, c; c = a + b; sprintf(buffer, "Sum of %d and %d is %d", a, b, c);
Thank you in advance!