summaryrefslogtreecommitdiffstats
path: root/electronics/stm32.txt
blob: d8b817cb37b73372cb672822db059cccbf1d85e9 (plain)
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

Memory Utilization
=====================

'text' is what ends up in flash (only).
'data' is initialized variables: need to be storad in flash, then end up in RAM.
'bss' is uninitialized data: nothing in flash, but does consume RAM.

The "-x --format=sysv" flags to arm-none-eabi-size can be helpful.

Debugging
================

Access all registers:

    (gdb) x/x 0xE000ED14 
    0xe000ed14:     Cannot access memory at address 0xe000ed14
    (gdb) 
    0xe000ed18:     Cannot access memory at address 0xe000ed18
    (gdb) show mem inaccessible-by-default
    Unknown memory addresses will be treated as inaccessible.
    (gdb) set mem inaccessible-by-default off
    (gdb) x/x 0xE000ED14 
    0xe000ed14:     0x00000200

Uploading via SWD
====================

upload_blackmagic.sh:

    #!/bin/bash
    arm-none-eabi-gdb build/stm32f401cc_telemetry.elf < load_blackmagic.gdb
    sleep 1.0

load_blackmagic.gdb:

    target extended-remote /dev/ttyACM0
    monitor swdp_scan
    attach 1
    load
    quit

References
=============

Keil Application Note 209: Using Cortex-M3 and Cortex-M4 Fault Exceptions

ARM Cortex-M3 HardFault Status Register Documentation:
http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0553a/Cihdjcfc.html