Post date: Nov 07, 2017 2:15:49 AM
Below is template for NUC131. UART is always used to debug/print. Seems like semihosting is default. We need to add 'semihosting' in the notes somehow.
#include <stdio.h>
#include "NUC131.h"
void SYS_Init(void)
{
SYS_UnlockReg();
CLK->APBCLK = CLK_APBCLK_UART0_EN_Msk;
SystemCoreClockUpdate();
SYS->GPB_MFP = SYS_GPB_MFP_PB0_UART0_RXD | SYS_GPB_MFP_PB1_UART0_TXD;
SYS_LockReg();
}
int main()
{
int8_t ch;
SYS_Init();
UART_Open(UART0, 115200);
printf("Simple Demo Code\n\n");
printf("Please Input Any Key\n\n");
do {
printf("Input: ");
ch = getchar();
printf("%c\n", ch);
} while(1);
}