README.md 2.66 KB
Newer Older
Martin Horauer's avatar
Martin Horauer committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# About

The following guide describes the steps to build and run the mbed applications
targeting the XMC 4500 Relax Kit board from Infineon.

The `mbed-os` folder contains the MBED platform with various drivers for the
XMC platform. At the moment this is kept in a separate repository from the
main mbed project hosted on github at https://github.com/mbed-Infineon-XMC/mbed-os[https://github.com/mbed-Infineon-XMC/mbed-os].

The example applications are obtained from https://github.com/mbed-Infineon-XMC?tab=repositories[https://github.com/mbed-Infineon-XMC?tab=repositories] and are 
structured in folders named like `APP_XXX`.

## Import the project

```
$ git clone https://es.technikum-wien.at/bel/bel4_ezb_public.git
$ cd XMC_MBED/
```

# Step-by-Step Building/Flashing/Debugging

## Compile a project

Navigate into the project folder and build it using:

```
cd APP_BB_BLINKY/
mbed compile -m XMC_4500_RELAX_KIT -t GCC_ARM -N main
```
mbed creates a BUILD directory where you can find the executable (`*.bin`, `*.elf`, `*.hex` ...).

[NOTE]
When using MS-Windows delete the existing Unix symbolic-link `mbed-os` and 
replace it with a Windows symbolic link using `mklink /D mbed-os ..\mbed-os`.

## Flash the application to the Relax-Kit

Use the JLink tools to flash the application hexfile to the Relax-Kit.

```
$ JLinkExe -device XMC4500-1024 -if SWD -speed 4000 -autoconnect 1
J-LINK> h
J-Link> loadfile BUILD/XMC_4500_RELAX_KIT/GCC_ARM/main.hex
J-Link> r
J-Link> g
```

## Debugging

Martin Horauer's avatar
Martin Horauer committed
50
To the debug the application 4 steps in sequence are necessary.
Martin Horauer's avatar
Martin Horauer committed
51

Martin Horauer's avatar
Martin Horauer committed
52
53
54
55
56
57
58
59
(1) You will need to create the executable with DEBUg symbols. To that end add 
`--profile mbed-os/tools/profiles/debug.json` to the build command.

```
mbed compile -m XMC_4500_RELAX_KIT -t GCC_ARM -N main --profile mbed-os/tools/profiles/debug.json
```

(2) Start the `JLinkGDEBServer`, e.g.:
Martin Horauer's avatar
Martin Horauer committed
60
61
62
63
64

```
JLinkGDBServer -Device XMC4500-1024 -if SWD
```

Martin Horauer's avatar
Martin Horauer committed
65
(3) In order to log messages printed to `stdout` we connect to port 2333 via
Martin Horauer's avatar
Martin Horauer committed
66
67
68
69
70
71
telnet.

```
telnet 127.0.0.1 2333
```

Martin Horauer's avatar
Martin Horauer committed
72
(4) We launch the debugger and control the debug session:
Martin Horauer's avatar
Martin Horauer committed
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90

```
arm-none-eabi-gdb -q BUILD/XMC_4500_RELAX_KIT/GCC_ARM/main.elf
(gdb) target remote :2331
(gdb) monitor reset
(gdb) load
(gdb) monitor reset
(gdb) b main
(gdb) c
[...]
```

# Makefile Building/Flashing/Debugging

Using the prepared `Makefile` one can invoke trhe following actions in a more 
convenient way:

```
Martin Horauer's avatar
Martin Horauer committed
91
92
93
make          # build the application with debug symbols
make debug    # -"-
make release  # debug a release version of the project
Martin Horauer's avatar
Martin Horauer committed
94
95
96
97
98
99
100
make flash    # flash the application
make debug    # debug the application
make erase    # erase the program memory
make doc      # invoke doxygen
make clean    # clean the project
```