README.adoc 1.83 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
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
= Real-Time-Clock (RTC) Example

This example illustrates how to use a Real Time Clock (RTC). To measure longer
times it is recommended to make use of the RTC. If the RTC is initialized the
standard C date and time functions can be used.

[NOTE]
Epoche-converts are available to get the Unix timestamp to configure the RTC, 
see https://www.epochconverter.com/[https://www.epochconverter.com/].

image::rtc_uart.png[]


== Makefile Usage

[source%nowrap, bash]
----
make          # build the application
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
----

= Manual 

== Building

[source%nowrap, bash]
----
mbed compile -c -m XMC_4500_RELAX_KIT -t GCC_ARM -N main
----

This creates several files in the BUILD directory where you can find the
executable (bin, elf, hex ...).

== Flashing

[source%nowrap, bash]
----
$ JLinkExe -Device XMC4500-1024 -if SWD -speed 4000
J-LINK> h
J-Link> loadfile BUILD/XMC_4500_RELAX_KIT/GCC_ARM/main.hex
J-Link> r
J-Link> g
----

== Debugging

(1) Build the application with debug symbols enabled by adding `--profile mbed-os/tools/profiles/debug.json`.

[source%nowrap, bash]
----
mbed compile -c -m XMC_4500_RELAX_KIT -t GCC_ARM -N main --profile mbed-os/tools/profiles/debug.json
----

(2) Start the `JLinkGDEBServer`, e.g.:

[source%nowrap, bash]
----
JLinkGDBServer -Device XMC4500-1024 -if SWD
----

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

[source%nowrap, bash]
----
telnet 127.0.0.1 2333
----

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

[source%nowrap, bash]
----
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
[...]
----