Chapter 3. GNU/Linux

Step 1. Type in the following program in text editor like gedit or kedit and save it as hello.c

#include <board.h>
#include <lcd.h>

int main()
{
        board_init();
        lcd_init();

        lcd_puts("Hello World!\n");
        return 0;
}

Step 2. Open a terminal, switch to the folder containing the C file and compile it using the following command.

$ zcc zkit-51-rd2 hello.c

Step 3. Fix the errors, if any and check the folder for executable file with the extension ihx.

Step 4. Connect the ZKit-51-RD2 to the PC using the USB cable. Start smash as show below.

$ smash-gui

Step 5. In the smash window, select the serial device from the drop down box. It is usually /dev/ttyUSB0 or /dev/ttyUSB1.

Step 6. Select the hex file generated in Step 3, under the Hex File section.

Step 7. Click on the Program button to download the hex file, on to the micro-controller.

Figure 3.1. Download using Smash

Smash Screenshot