README.adoc 2.94 KB
Newer Older
Martin Horauer's avatar
lol2    
Martin Horauer committed
1
2
3
4
5
6
7
8
9
10
11
12
# 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`.

13
14
15
16
17
[TIP]
Checkout the comments in the main.cpp files of every application - these 
examples are heavily commented and refer to the respective files where the 
classes, methods and definitions are found.

Martin Horauer's avatar
lol2    
Martin Horauer committed
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
## 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

To the debug the application 4 steps in sequence are necessary.

(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.:

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

(3) In order to log messages printed to `stdout` we connect to port 2333 via
telnet.

```
telnet 127.0.0.1 2333
```

(4) We launch the debugger and control the debug session:

```
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:

```
make          # build the application with debug symbols
make debug    # -"-
make release  # debug a release version of the project
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
```

Martin Horauer's avatar
lol3    
Martin Horauer committed
106
107
108


///////////////////////////////////////////////////////////////////////////////