|
| 1 | +# Getting Started with EM Software Development Platform |
| 2 | + |
| 3 | +!!! info |
| 4 | + |
| 5 | + Consider reading these guides firstly: |
| 6 | + |
| 7 | + * [Configuring EM Software Development Platform](../../platforms/board-emsdp.md) |
| 8 | + * [Installing WinUSB driver on Windows](../../platforms/winusb.md) |
| 9 | + |
| 10 | +## Creating the Project |
| 11 | + |
| 12 | +Select **File** → **New** → **Project..** and choose **C Project**. |
| 13 | +A list of ARC projects will appear. Choose any ARC EM Starter Kit |
| 14 | +"Hello World" project from the **ARC EM SDP Projects** group. |
| 15 | + |
| 16 | + |
| 17 | + |
| 18 | +After creating the project, a simple "Hello, World!" program will be created: |
| 19 | + |
| 20 | +```c |
| 21 | +/* Print a greeting on UART output and exit. */ |
| 22 | + |
| 23 | +#include <stdio.h> |
| 24 | + |
| 25 | +int main(int argc, char *argv[]) |
| 26 | +{ |
| 27 | + printf("Hello, World!\n\r"); |
| 28 | + return 0; |
| 29 | +} |
| 30 | +``` |
| 31 | +
|
| 32 | +## Building the Project |
| 33 | +
|
| 34 | +Do right click on a project in **Project Explorer** ans choose **Build Project**. |
| 35 | +The project will be built with this output: |
| 36 | +
|
| 37 | +```text |
| 38 | +make all |
| 39 | +Building file: ../src/main.c |
| 40 | +Invoking: ARC GNU C Compiler |
| 41 | +/SCRATCH/ykolerov/tools/arc-2023.09/ide_fixed/bin/arc-elf32-gcc -mcpu=em4_fpuda -mcode-density -mdiv-rem -mswap -mnorm -mmpy-option=6 -mbarrel-shifter -mfpu=fpuda_all --param l1-cache-size=16384 --param l1-cache-line-size=32 -include /SCRATCH/ykolerov/ARC_GNU_IDE_Workspace/emsdp/Debug/core_config.h -O0 -g3 -Wall -c -fmessage-length=0 -gdwarf-2 -Wa,-adhlns="src/main.o.lst" -MMD -MP -MF"src/main.d" -MT"src/main.o" -o "src/main.o" "../src/main.c" |
| 42 | +Finished building: ../src/main.c |
| 43 | + |
| 44 | +Building target: emsdp.elf |
| 45 | +Invoking: ARC GNU C Linker |
| 46 | +/SCRATCH/ykolerov/tools/arc-2023.09/ide_fixed/bin/arc-elf32-gcc -mcpu=em4_fpuda -mcode-density -mdiv-rem -mswap -mnorm -mmpy-option=6 -mbarrel-shifter -mfpu=fpuda_all --param l1-cache-size=16384 --param l1-cache-line-size=32 -specs=emsdp1.1.specs -Wl,-Map,emsdp.map -o "emsdp.elf" ./src/main.o |
| 47 | +Finished building target: emsdp.elf |
| 48 | +``` |
| 49 | + |
| 50 | +## Creating a Debug Configuration |
| 51 | + |
| 52 | +Do right click on projects's name in **Project Explorer** and choose |
| 53 | +**Debug As** → **Debug Configurations...**. Then do right click on |
| 54 | +**ARC C/C++ application** and choose **New Configuration**. Here is a main window of |
| 55 | +the debug configuration: |
| 56 | + |
| 57 | + |
| 58 | + |
| 59 | +Ensure that a correct project and binary are selected. Navigate to **Main** tab |
| 60 | +and **Gdbserver Settings** inner tab: |
| 61 | + |
| 62 | + |
| 63 | + |
| 64 | +Choose **JTAG via OpenOCD** as ARC GDB Server and **EM Software Development Platform** as |
| 65 | +a development system (use a corresponding one for your case). Then click on **Apply**. |
| 66 | + |
| 67 | +## Configuring a Serial Terminal |
| 68 | + |
| 69 | +Navigate to **Terminal** inner tab of **Main** tab and select a COM port for |
| 70 | +the board. Eclipse automatically detects all available COM ports. In my case |
| 71 | +it's `/dev/ttyUSB6`. |
| 72 | + |
| 73 | + |
| 74 | + |
| 75 | +On Windows you can find the exact number in **Device Manager** (it corresponds |
| 76 | +to **USB Serial Port** device): |
| 77 | + |
| 78 | + |
| 79 | + |
| 80 | +On Linux a serial device for EM Software Development Platform is usually `/dev/ttyUSB1` |
| 81 | +if there are no other serial devices connected to the host. |
| 82 | + |
| 83 | +## Debugging the Project |
| 84 | + |
| 85 | +Open the debug configuration in **Debug Configurations** windows and click |
| 86 | +on **Debug** button. The **Debug** perspective will be opened: |
| 87 | + |
| 88 | + |
| 89 | + |
| 90 | +Use **Step Over** button to step over `printf` function and select **Terminal** |
| 91 | +in the bottom of the window. "Hello world!" string will be printed: |
| 92 | + |
| 93 | + |
0 commit comments