STM32F4-Discovery development environment for Ubuntu linux 14.04


Ref: http://guttula.com/STM32F4/toolchain-setup.html


flash erase

$ sudo st-flash erase
2016-04-18T17:48:23 INFO src/stlink-common.c: Loading device parameters....
2016-04-18T17:48:23 INFO src/stlink-common.c: Device connected is: F42x and F43x device, id 0x10036419
2016-04-18T17:48:23 INFO src/stlink-common.c: SRAM size: 0x40000 bytes (256 KiB), Flash: 0x200000 bytes (2048 KiB) in pages of 16384 bytes
Mass erasing.............

flash write

 sudo st-flash write ./blinky.bin 0x8000000
2016-04-18T17:49:18 INFO src/stlink-common.c: Loading device parameters....
2016-04-18T17:49:18 INFO src/stlink-common.c: Device connected is: F42x and F43x device, id 0x10036419
2016-04-18T17:49:18 INFO src/stlink-common.c: SRAM size: 0x40000 bytes (256 KiB), Flash: 0x200000 bytes (2048 KiB) in pages of 16384 bytes
2016-04-18T17:49:18 INFO src/stlink-common.c: Attempting to write 27492 (0x6b64) bytes to stm32 address: 134217728 (0x8000000)
EraseFlash - Sector:0x0 Size:0x4000
Flash page at addr: 0x08000000 erasedEraseFlash - Sector:0x1 Size:0x4000
Flash page at addr: 0x08004000 erased
2016-04-18T17:49:48 INFO src/stlink-common.c: Finished erasing 2 pages of 16384 (0x4000) bytes
2016-04-18T17:49:48 INFO src/stlink-common.c: Starting Flash write for F2/F4/L4
2016-04-18T17:49:48 INFO src/stlink-common.c: Successfully loaded flash loader in sram
enabling 32-bit flash writes
size: 27492
2016-04-18T17:49:48 INFO src/stlink-common.c: Starting verification of write complete
2016-04-18T17:49:48 INFO src/stlink-common.c: Flash written and verified! jolly good!


----

UART


pinout map

Ref: https://www.mbed.com/en/development/hardware/boards/st/disco_f429zi/

/media/uploads/bcostm/disco_f429zi_mbed_pinout_v2_p1.png


app.cpp

#include "mbed-drivers/mbed.h"


Serial pc(PA_9, PA_10); //tx, rx

static void blinky(void) {
    static DigitalOut led(LED1);
    led = !led;
    printf("LED = %d \r\n",led.read());
}

void app_start(int, char**) {
    pc.baud(38400);

    for (int i=0; i<1000; i++) {
        pc.printf("i=%d\r\n",i);
        wait(1);
    }
}

----

screen

sudo screen /dev/ttyUSB0 38400


留言

熱門文章