6 years, 2 months ago.

What happens on the background when mbed CLI flashes the chip?

Even though not every detail is relevant for this question, I will list my setup nonetheless:

To compile my code and flash the binary to the chip, I issue the following command in my cmd terminal:

> mbed compile -t GCC_ARM -m NUCLEO_F746ZG --flash

I get the following output:

output in my terminal

    
    +------------------+-------+-------+-------+
    | Module           | .text | .data |  .bss |
    +------------------+-------+-------+-------+
    | [fill]           |   130 |     4 |    10 |
    | [lib]\c.a        | 24965 |  2472 |    89 |
    | [lib]\gcc.a      |  3120 |     0 |     0 |
    | [lib]\misc       |   252 |    16 |    28 |
    | mbed-os\drivers  |   658 |     4 |   100 |
    | mbed-os\features |    74 |     0 | 12556 |
    | mbed-os\hal      |  2634 |     4 |    66 |
    | mbed-os\platform |  2977 |     4 |   270 |
    | mbed-os\rtos     | 15887 |   168 |  5989 |
    | mbed-os\targets  | 16013 |     4 |  1052 |
    | source\main.o    |   244 |     4 |    84 |
    | Subtotals        | 66954 |  2680 | 20244 |
    +------------------+-------+-------+-------+
    Total Static RAM memory (data + bss): 22924 bytes
    Total Flash memory (text + data): 69634 bytes

    Image: .\BUILD\NUCLEO_F746ZG\GCC_ARM\nucleo_f746zg_demo.bin
    [mbed] Detected "NUCLEO_F746ZG" connected to "E:" and using com port "COM10"
            1 file(s) copied.

I'm particularly interested in the last lines, where the actual flashing of the chip takes place:

output in my terminal

    Image: .\BUILD\NUCLEO_F746ZG\GCC_ARM\nucleo_f746zg_demo.bin
     [mbed] Detected "NUCLEO_F746ZG" connected to "E:" and using com port "COM10"
             1 file(s) copied.

I know from previous experience (before mbed CLI existed) that there is a lot going on to flash a binary to a chip. For example, I had to startup openocd, pass it a configuration file of the programmer (eg. stlink-v2-1.cfg) and a configuration file of the target board (eg. nucleo_f746zg.cfg). At last, I had to hand over the binary to openocd via a Telnet-session or a GDB-session. Everything is described extensively here: https://stackoverflow.com/questions/38033130/how-to-use-the-gdb-gnu-debugger-and-openocd-for-microcontroller-debugging-fr

Looking at mbed CLI flashing the chip, I get confused. What is happening on the background? Is mbed CLI secretly using openocd to connect to the chip? Or perhaps pyOCD? Or some other way?

I would love to know what happens on the background :-)

Be the first to answer this question.