[SOLVED]Imposible to flash with STLink v2 key ( STM32F1xx and STM32F4xx)

jcbuntu
Posts: 27
Joined: Wed Jun 02, 2021 1:47 pm
Location: Andon 06 - France

Re: Imposible to flash with STLink v2 key ( STM32F1xx and STM32F4xx)

Post by jcbuntu »

... step by step ... and it's work now !

In my previous post, i've remarked that Arduino_STM32-master use tools in .../arduino-1.8.13/hardware/Arduino_STM32-master/tools/linux.
but these tools don't work on a Linux 64 PC. Good tools are in .../arduino-1.8.13/hardware/Arduino_STM32-master/tools/linux64

So i've disabled the first directorate by renaming .../arduino-1.8.13/hardware/Arduino_STM32-master/tools/linux_old
and rename .../arduino-1.8.13/hardware/Arduino_STM32-master/tools/linux64 in .../arduino-1.8.13/hardware/Arduino_STM32-master/tools/linux

Now, STLink key and f407VG board are recognized, and toolchain works :

Code: Select all

Le croquis utilise 18040 octets (3%) de l'espace de stockage de programmes. Le maximum est de 514288 octets.
Les variables globales utilisent 5544 octets (4%) de mémoire dynamique, ce qui laisse 125528 octets pour les variables locales. Le maximum est de 131072 octets.
USB Status [unknown]
2021-06-14T16:53:56 INFO src/common.c: Loading device parameters....
2021-06-14T16:53:56 INFO src/common.c: Device connected is: F4 device, id 0x10076413
2021-06-14T16:53:56 INFO src/common.c: SRAM size: 0x30000 bytes (192 KiB), Flash: 0x80000 bytes (512 KiB) in pages of 16384 bytes
2021-06-14T16:53:56 INFO src/common.c: Attempting to write 20664 (0x50b8) bytes to stm32 address: 134217728 (0x8000000)
Flash page at addr: 0x08000000 erasedEraseFlash - Sector:0x1 Size:0x4000 2021-06-14T16:53:57 INFO src/common.c: Finished erasing 2 pages of 16384 (0x4000) bytes
2021-06-14T16:53:57 INFO src/common.c: Starting Flash write for F2/F4/L4
2021-06-14T16:53:57 INFO src/common.c: Successfully loaded flash loader in sram
Flash page at addr: 0x08004000 erased2021-06-14T16:53:57 INFO src/common.c: Starting verification of write complete
2021-06-14T16:53:58 INFO src/common.c: Flash written and verified! jolly good!

enabling 32-bit flash writes
size: 20664
USB Status [unknown]
It's an inelegant patch ... but it work. So i would know how Arduino_STM32-master use this directorate. But it's another story !
Special thanks to ag123 who hardly help me and light me on STM32 tool chain, and fredbox for answers and information on STM32Cube.
User avatar
fpiSTM
Posts: 1723
Joined: Wed Dec 11, 2019 7:11 pm
Answers: 91
Location: Le Mans
Contact:

Re: [SOLVED]Imposible to flash with STLink v2 key ( STM32F1xx and STM32F4xx)

Post by fpiSTM »

You should install the libusb 1.0.0 for i386.
https://packages.ubuntu.com/search?keyw ... busb-1.0-0
jcbuntu
Posts: 27
Joined: Wed Jun 02, 2021 1:47 pm
Location: Andon 06 - France

Re: [SOLVED]Imposible to flash with STLink v2 key ( STM32F1xx and STM32F4xx)

Post by jcbuntu »

OK, perhaps it's a good way but it's not resolve the initial problem : why Arduino_STM32-master use linux tools and not linux64 tools ?
I've found a bad but simply patch witch work and i don't want to install other specific software on the PS OS to correct an anomaly.

For information, STLink key work on F407VE and DIY MORE F407VG.
Nice to read you.
mrburnette
Posts: 633
Joined: Thu Dec 19, 2019 1:23 am
Answers: 7

Re: [SOLVED]Imposible to flash with STLink v2 key ( STM32F1xx and STM32F4xx)

Post by mrburnette »

jcbuntu wrote: Tue Jun 15, 2021 2:30 pm OK, perhaps it's a good way but it's not resolve the initial problem : why Arduino_STM32-master use linux tools and not linux64 tools ?
I've found a bad but simply patch witch work and i don't want to install other specific software on the PS OS to correct an anomaly.
...
32-64 libraries for Linux are not patches; they are OS enablers; same as the 8/16, 16/32, and 32/64-bit "thunk" libraries for Windows. This is an architectural design and is the way the world handles simple OS bit translations. Of course, you have an option if you "do not like it": Run a 32-bit VM within your 64-bit OS.
ag123
Posts: 1653
Joined: Thu Dec 19, 2019 5:30 am
Answers: 24

Re: [SOLVED]Imposible to flash with STLink v2 key ( STM32F1xx and STM32F4xx)

Post by ag123 »

jcbuntu wrote: Tue Jun 15, 2021 2:30 pm OK, perhaps it's a good way but it's not resolve the initial problem : why Arduino_STM32-master use linux tools and not linux64 tools ?
I've found a bad but simply patch witch work and i don't want to install other specific software on the PS OS to correct an anomaly.

For information, STLink key work on F407VE and DIY MORE F407VG.
Nice to read you.
these days 'most' linux distributions use straight 64 bits, but it is just 'most' (some of the 'older' ones e.g. on RPi even today uses 32 bits!)
and some of the intel compute sticks insist on 32 bits. the thing about path is such, if you have on your path both the 32 bit binaries and 64 bit binaries.
and that if the 32 bit one is earlier in the sequence, that one runs first. so you get your error.
of course you can analyze things and figure out if it is possible to provide a PR to 'fix' it. libmaple has a long history,
it has been around when some enterprising people from MIT created a 'duino' out of stm32 it is an idea that has grown up and proven its resilience.
http://docs.leaflabs.com/docs.leaflabs.com/index.html
https://www.leaflabs.com/maple
it is around when most linuxes is about just 32 bits widely used.
32bit binaries still persist today in some closed source 'driver' blobs, if that goes missing, you get a piece of hardware that's pretty much a doorstop.
and those could include lan cards, wifi cards / adapters and various usb 'drivers' (lots of them)
User avatar
fpiSTM
Posts: 1723
Joined: Wed Dec 11, 2019 7:11 pm
Answers: 91
Location: Le Mans
Contact:

Re: [SOLVED]Imposible to flash with STLink v2 key ( STM32F1xx and STM32F4xx)

Post by fpiSTM »

The original problem comes from Arduino which does not handle properly host OS arch, I've corrected this several years ago:
https://github.com/stm32duino/Arduino_T ... -266970415

The best solution (IMHO) is to check this in the script itself:
Replace this line:
https://github.com/rogerclarkmelbourne/ ... _upload#L2

Code: Select all

- $(dirname $0)/stlink/st-flash write "$1" 0x8000000
+ if [ `uname -m` ==  "x86_64" ]; then
+   $(dirname $0)/../linux64/stlink/st-flash write "$1" 0x8000000
+ else
+   $(dirname $0)/stlink/st-flash write "$1" 0x8000000
+ fi
jcbuntu
Posts: 27
Joined: Wed Jun 02, 2021 1:47 pm
Location: Andon 06 - France

Re: [SOLVED]Imposible to flash with STLink v2 key ( STM32F1xx and STM32F4xx)

Post by jcbuntu »

Yessssss ! This subject was in actuality five years before !
Thank you, fpiSTM for these links where we can see a good and elegant answer. it's what i expect.
Idem ag123 : it's exactly this -> transition between 32 and 64 bits apps isn't easy !
mrburnette : i don't understand what you say about this post subject ... When i say "patch", it's mine to solve the problem ! And for simply solve him, i think that VM or comments about packet aren't the good way.
Post Reply

Return to “STLink”