Step 1. Type in the following program in a text editor like notepad and save
it as hello.c
.
#include <nuttx/config.h>
#include <stdio.h>
int app_main(int argc, char *argv[])
{
printf("Hello, World!!\n");
return 0;
}
Step 2. Open a DOS box, switch to the folder containing the C file and compile it using the following command.
> nuttx-config.bat zkit-arm-1769
> arm-none-eabi-gcc hello.c %NUTTX_CFLAGS% %NUTTX_LDFLAGS% -o hello.elf
> arm-none-eabi-objcopy hello.elf --target=ihex hello.hex
Step 3. Fix the errors, if any and check the folder for the executable file
hello.hex
.
Step 4. Connect the development kit to the PC, through the USB-UART
mini
connector. Press the PROG
button, to switch into Programming
Mode. (PROG
LED On)
Step 5. Open Flash Magic,select the following parameters in the Flash Magic window, under Communications section.
Step 5. Select the Erase block used by Hex File
check box, under the Erase
section.
Step 6. Select the hex file generated in Step 3, under the Hex File
section.
Step 7. Click on the start button to download the hex file, on to the micro-controller.
Step 8. Press the PROG
button, to switch into Serial Communication
Mode. (PROG
LED Off)
Open Termite, serial terminal program and configure 115200 baudrate, 8 data bits, no parity, 1 stop bit.
Press the RESET
button, to execute the downloaded program. The
"Hello World" message should get displayed on the serial terminal.