Unknown coreid

Post Reply
BitSeeker
Posts: 2
Joined: Wed Feb 08, 2023 4:35 pm

Unknown coreid

Post by BitSeeker »

So its my first time using an STM32. I've had it sitting in a box for a while, but I need a 3.3v device with plenty of pins so dug it out along with the STLINKv2 to have a go at programming it from the Arduino IDE. have looked at a couple of tutorials, in particular this one:

https://www.onetransistor.eu/2017/11/st ... o-ide.html

I was steered away form using UART to program the STM323F103 and instead purchased an ST-LINKv2. I was informed this works flawlessly. I am working on Linux Mint 20.3.

Steps taken so far are:
- STM32F103C board prepped. 10k resistor removed. 1.5k installed. (Didn't have a 1.8k on hand)
- tan the install.sh script to install the UDEV rules
- PC rebooted
- jumper on boot0 moved to the '1' position
- bootloader file generic_boot20_pc13.bin downloaded from Rioger Clark's Github page

I then ran st-info which returned:

Code: Select all

$ ./st-info --probe
Found 1 stlink programmers
 serial: 4700310005000059334d524e
openocd: "\x47\x00\x31\x00\x05\x00\x00\x59\x33\x4d\x52\x4e"
  flash: 65536 (pagesize: 1024)
   sram: 20480
 chipid: 0x0410
  descr: F1 Medium-density device
One slight difference here is that the board I have reports 64k flash instead of 128k. The serial number and openocd sequence is also different to that shown in the example.

Tje next step is to run st-flash, and this fails:

Code: Select all

$ ./st-flash --reset write generic_boot20_pc13.bin 0x8000000
2023-02-08T16:04:00 INFO src/common.c: Loading device parameters....
2023-02-08T16:04:00 INFO src/common.c: Device connected is: F1 Medium-density device, id 0x20036410
2023-02-08T16:04:00 INFO src/common.c: SRAM size: 0x5000 bytes (20 KiB), Flash: 0x10000 bytes (64 KiB) in pages of 1024 bytes
2023-02-08T16:04:00 INFO src/common.c: Attempting to write 22268 (0x56fc) bytes to stm32 address: 134217728 (0x8000000)
Flash page at addr: 0x08005400 erased
2023-02-08T16:04:00 INFO src/common.c: Finished erasing 22 pages of 1024 (0x400) bytes
2023-02-08T16:04:00 INFO src/common.c: Starting Flash write for VL/F0/F3 core id
2023-02-08T16:04:00 ERROR src/common.c: unknown coreid, not sure what flash loader to use, aborting!: 2ba01477
2023-02-08T16:04:00 WARN src/common.c: Failed to write flash loader to sram!
2023-02-08T16:04:00 ERROR src/common.c: init_flash_loader() == -1
stlink_fwrite_flash() == -1
Tried re-booting the PC, restarting the board, etc but nothing changes. The error is still present.#
I haven't actually reached the stage of using the IDE yet!

Just wondering whether any one else has come across this and whether they solved it?
BitSeeker
Posts: 2
Joined: Wed Feb 08, 2023 4:35 pm

Re: Unknown coreid

Post by BitSeeker »

With a bit of help I have now resolved the problem. It seems that the problem is the version of the st-util tools supplied with the STM32F301 library for Arduino IDE. The problem exists in both versions 1.8.19 and 2.0.3.

The following packages were installed:

Code: Select all

$ sudo apt-get -d install libstlink1 stlink-tools stlink-gui
This allowed binaries to be uploaded using a terminal command like:

Code: Select all

$ st-flash --reset write filename.bin 0x8000000
where filename.bin is the name of the binary compiled for the STM32F301. Exported binaries (Sketch->Export Compiled Binary) could now be uploaded to the STM32F301C8 board manually. Getting this to work automatically within the Arduino IDE required a little more work. The workaround was to edit the stlink_upload file that is located in .arduino15/packages/stm32duino/tools/stm32tools/2022.9.26/linux./. The following line was commented out:

Code: Select all

$(dirname $0)/stlink/st-flash write "$1" 0x8000000
this was replaced with:

Code: Select all

/usr/bin/st-info --probe
/usr/bin/st-flash --reset write "$1" 0x8000000
The upload script now calls the working system installed version of the utilities rather than those supplied with the STM32F301 library. That worked for both version 1.8.19 and 2.0.3 of the IDE. There seems to be a slight delay at the end of the process as the script waits for the board to become available which takes a few seconds. Not sure whether that test is needed or not? This is not a problem when uploading manually.
Post Reply

Return to “STLink”