Thanks a lot for your responses! I tried to add a custom target with the following steps:
- Created the blinky example:
mbed import mbed-os-example-blinky
- Created a
custom_targets.json
with the following content:
{
"WOMOLIN_V2": {
"inherits": [
"MCU_STM32L476xG"
]
}
}
- Generated the pin mapping files following the link to the README posted by @JohnnyK :
Inside mbed-os-example-blinky
cd mbed-os
python targets/TARGET_STM/tools/STM32_gen_PeripheralPins.py -m "STM32L476Z(E-G)Tx.xml"
- Copied
PeripheralPins.c
and PinNames.h
from mbed-os/targets_custom/TARGET_STM/TARGET_STM32L4/TARGET_STM32L476xG/TARGET_STM32L476ZGT
to a new folder TARGET_WOMOLIN_V2
inside mbed-os-example-blinky
- Changed the content of
PinNames.h
to match my configuration (see here)
- Compiled the code with
mbed compile -m WOMOLIN_V2 -t GCC_ARM
Am I on the right track so far?
I noticed a warning when compiling:
Configuration error: Bootloader not supported on this target. ROM start not found in targets.json.
Configuration error: Bootloader not supported on this target. RAM start not found in targets.json.
As far as I understand, the ROM and RAM start should be defined in the target.json, which I am extending with my custom_targets.json
. I would expect the inherits
to take the values for the RAM and ROM start from the already defined parent definition MCU_STM32L476xG
. Any ideas what is happening here? How can I fix that?
I set the STM32 into bootloader mode by pressing the boot button on the board and connecting it to USB. lsusb
lists it as Bus 001 Device 018: ID 0483:3748 STMicroelectronics ST-LINK/V2
. When executing mbed compile -m WOMOLIN_V2 -t GCC_ARM -f
to flash the code, I get
[1614191038.26][mbedls.lstools_linux]Could not get serial devices by id. This could be because your Linux distribution does not use udev, or does not create /dev/serial/by-id symlinks. Please submit an issue to github.com/armmbed/mbed-ls.
I think this may be my setup of mbed (installed via aur on Arch Linux).
I also tried flashing the firmware using Mbed Studio. When connecting the board in bootloader mode, it does show up as STM32 BOOTLOADER. I added the configuration as you can see in the screenshot here:
When clicking “Run program”, Mbed seems to be stuck. Checking running processes, I noticed pyocd flash
running in the background, but it won’t finish. Clicking “Debug program” quits with a timeout: “Timeout waiting for gdb server”
Is it possible to get Mbed Studio to flash my program or should I stick with flashing via my STLinkV2?
Thank you very much for your answers!