Now I'm trying to understand the CM3 firmware code. But especially I found some of the code is made by asm code as the below,
unsigned char UartPutc(unsigned char my_ch) { while ((CMSDK_UART2->STATE & 1)); // Wait if Transmit Holding register is full CMSDK_UART2->DATA = my_ch; // write to transmit holding register return (my_ch); } // Uart string output void UartPuts(unsigned char * mytext) { unsigned char CurrChar; do { CurrChar = *mytext; if (CurrChar != (char) 0x0) { UartPutc(CurrChar); // Normal data } *mytext++; } while (CurrChar != 0); return; } #if defined ( __CC_ARM ) /* ARM RVDS or Keil MDK */ __asm void FlashLoader_ASM(void) { MOVS R0,#0 LDR R1,[R0] ; Get initial MSP value MOV SP, R1 LDR R1,[R0, #4] ; Get initial PC value BX R1 }
So I want to print MSP value and PC value out by using UartPutc function. Would you please guide me how am I supposed to do to print it out ?
Couldn't you just decompose the hex digits using simple math?
How about using itoa() or sprintf() to create as string, and then UartPuts() it?
Perhaps you work with more experienced people who can walk you through this locally?
Is there any way to print MSP and PC value out for debugging ?