Mos flash "No STM32 devices found"

I now try to install Mongoose-OS on an F746ZG-Dev. board.
Under Linux, with installed st-flash, stm32cubeprg and mos.
Flashing of prgname.bin works via ST-Flash, Cubeide
and Arduino. (see below)

But “mos flash” fails with:

Loaded app3/stm32 version 1.0 (20230710-070847)
Error: /src/cli/flash.go:213: No STM32 devices found
/src/cli/main.go:194: flash failed

The udev-rules are set, the device is connected and ready -
What am I doing wrong ?

regards

wicki

ST-Info-descr
F7XX
ST-Info-Flash
0x100000
ST-Info-version
V1.7.0
ST-Info-chipid
0x0449

this is working:

st-flash --reset write nucleo-f746zg-cube-baremetal.bin 0x8000000
st-flash 1.7.0
2023-07-10T13:31:59 INFO common.c: F7xx: 320 KiB SRAM, 1024 KiB flash in at least 2 KiB pages.
file nucleo-f746zg-cube-baremetal.bin md5 checksum: b57c1cfff2ef1dd3e25c14803cfec9ac, stlink checksum: 0x00f34ce7
2023-07-10T13:32:00 INFO common.c: Attempting to write 174692 (0x2aa64) bytes to stm32 address: 134217728 (0x8000000)
EraseFlash - Sector:0x0 Size:0x8000 2023-07-10T13:32:00 INFO common.c: Flash page at addr: 0x08000000 erased
EraseFlash - Sector:0x1 Size:0x8000 2023-07-10T13:32:00 INFO common.c: Flash page at addr: 0x08008000 erased
EraseFlash - Sector:0x2 Size:0x8000 2023-07-10T13:32:01 INFO common.c: Flash page at addr: 0x08010000 erased
EraseFlash - Sector:0x3 Size:0x8000 2023-07-10T13:32:01 INFO common.c: Flash page at addr: 0x08018000 erased
EraseFlash - Sector:0x4 Size:0x20000 2023-07-10T13:32:02 INFO common.c: Flash page at addr: 0x08020000 erased
2023-07-10T13:32:02 INFO common.c: Finished erasing 5 pages of 131072 (0x20000) bytes
2023-07-10T13:32:02 INFO common.c: Starting Flash write for F2/F4/F7/L4
2023-07-10T13:32:02 INFO flash_loader.c: Successfully loaded flash loader in sram
2023-07-10T13:32:02 INFO flash_loader.c: Clear DFSR
2023-07-10T13:32:02 INFO common.c: enabling 32-bit flash writes
2023-07-10T13:32:05 INFO common.c: Starting verification of write complete
2023-07-10T13:32:06 INFO common.c: Flash written and verified! jolly good!

https://mongoose-os.com/docs/mongoose-os/quickstart/devboards.md#stm32-nucleo-f746zg

Hi Scaprile,

ok - this is exactly what I have done.
And I have also tried several times:
git clone GitHub - mongoose-os-apps/demo-js: A JS-enabled demo Mongoose OS firmware
cd demo-js
mos build --platform stm32 --board NUCLEO-F746ZG
an got
[…]
Adding api_uart.js: SPIFFS_write failed: -10001
*** Out of space, tried to write 5772 bytes ***
/data/fwbuild-volumes/latest/apps/demo-js/stm32/build_contexts/build_ctx_2364830280/deps/modules/mongo

I do not understand, why “demo-js” should be to big for f746zg.
But ok…

Then I also tried several times:

git clone GitHub - mongoose-os-apps/empty
cd emty
mos build --platform stm32 --board NUCLEO-F746ZG

what ends up in:
Firmware saved to /media/[…]/MONGOOSE/mos/empty/build/fw.zip

This seems to OK.

But
mos flash stm32
each time ends up in:

Fetching https://github.com/mongoose-os-apps/demo-js/releases/download/latest/demo-js-stm32.zip
Error: /src/cli/ourutil/file.go:45: https://github.com/mongoose-os-apps/demo-js/releases/download/latest/demo-js-stm32.zip: failed to fetch: 404 Not Found
/src/common/fwbundle/fw_bundle_zip.go:57:
/src/cli/flash.go:152: failed to load https://github.com/mongoose-os-apps/demo-js/releases/download/latest/demo-js-stm32.zip
/src/cli/main.go:194: flash failed

Why it’s trying to get https://github.com/mongoose-os-apps/demo-js/releases/download/latest/demo-js-stm32.zip ?

The file is not an non-exisitg file. The repsond is not an http-404.
The file exists and contains “Not Found”.

https://github.com/mongoose-os-apps/demo-js/releases/download/latest/demo-js-stm32.zip

Whats the reason of this problem?

Regards
wicki

mos flash --port=/dev/ttyACM0 ? (or whichever your stlink serial is)

The device is /dev/ttyACM0.

And it is working fine with st-flash and nucleo-f746zg-cube-baremetal for example:

[…]mongoose/examples/stm32/nucleo-f746zg-cube-baremetal/Debug$ st-flash --reset write nucleo-f746zg-cube-baremetal.bin 0x8000000
st-flash 1.7.0
2023-07-14T08:00:15 INFO common.c: F7xx: 320 KiB SRAM, 1024 KiB flash in at least 2 KiB pages.
file nucleo-f746zg-cube-baremetal.bin md5 checksum: 3fc4188e7d531730a4ff182729478fc, stlink checksum: 0x00eb4507
[…]
2023-07-14T08:00:20 INFO common.c: Starting verification of write complete
2023-07-14T08:00:21 INFO common.c: Flash written and verified! jolly good!

But
mos flash --port=/dev/ttyACM0
from mongoose-os/empty results in:
(started by a bash-cmdline)

Loaded empty/stm32 version 1.0 (20230713-074338)
Using /usr/bin/st-flash
Flashing “app” (402696192 @ 0x8000000)…
Running /usr/bin/st-flash --serial 0x066BFF495087534867043639 write /tmp/empty_stm32_1.0_896133475/app 0x8000000
st-flash 1.7.0
2023-07-14T07:57:11 WARN usb.c: Couldn’t find any ST-Link devices
libusb: warning [libusb_exit] device 2.2 still referenced
libusb: warning [libusb_exit] device 2.1 still referenced
libusb: warning [libusb_exit] device 1.3 still referenced
libusb: warning [libusb_exit] device 1.9 still referenced
libusb: warning [libusb_exit] device 1.5 still referenced
libusb: warning [libusb_exit] device 1.72 still referenced
libusb: warning [libusb_exit] device 1.6 still referenced
libusb: warning [libusb_exit] device 1.4 still referenced
libusb: warning [libusb_exit] device 1.2 still referenced
libusb: warning [libusb_exit] device 1.1 still referenced
Error: exit status 255
/src/cli/ourutil/cmd.go:71:
/src/cli/flash/stm32/flasher_stflash.go:61: st-flash command failed
/src/cli/flash.go:237:
/src/cli/main.go:194: flash failed

The is no other process than “mos” that is using the device.

[…]/MONGOOSE/mos/empty$ mos flash stm32 --port=/dev/ttyACM0
Fetching https://github.com/mongoose-os-apps/demo-js/releases/download/latest/demo-js-stm32.zip
Error: /src/cli/ourutil/file.go:45: https://github.com/mongoose-os-apps/demo-js/releases/download/latest/demo-js-stm32.zip: failed to fetch: 404 Not Found
/src/common/fwbundle/fw_bundle_zip.go:57:
/src/cli/flash.go:152: failed to load https://github.com/mongoose-os-apps/demo-js/releases/download/latest/demo-js-stm32.zip
/src/cli/main.go:194: flash failed

Started by web-interface I get:
$ mos flash stm32 --port=/dev/ttyACM0
exit status 1
Command completed.

or

$ mos flash stm32
Fetching https://github.com/mongoose-os-apps/demo-js/releases/download/latest/demo-js-stm32.zip
Error: /src/cli/ourutil/file.go:45: https://github.com/mongoose-os-apps/demo-js/releases/download/latest/demo-js-stm32.zip: failed to fetch: 404 Not Found
/src/common/fwbundle/fw_bundle_zip.go:57:
/src/cli/flash.go:152: failed to load https://github.com/mongoose-os-apps/demo-js/releases/download/latest/demo-js-stm32.zip
/src/cli/main.go:194: flash failed
exit status 1
Command completed.

I have no idea any more…

…6 days ago…
it doesn’t look like anyone is interested in solving this problem.

it may be that this does not occur with other controllers - but that
there is a problem with the f746 is obvious.
and this occurs when following the instructions step by step.

or was someone able to reproduce this with a different result?

I’m quoting from your comment.

It tries to do this

and fails
It seems to take the .zip and do some magic on the files to extract the binary that will copy to /tmp and from there call st-flash to do it.
If you can get that file before it is cleaned, then you can manually call st-flash

Yeah, it should work in Ubuntu, are you running Ubuntu ? If so, please open an issue at the mos tool repo

This is exactly what I have done several days ago.
But let’s try it again on windows:

mos clone GitHub - mongoose-os-apps/demo-js: A JS-enabled demo Mongoose OS firmware app1

this is the result of

mos build --platform stm32 --build-var BOARD=NUCLEO-F746ZG

Connecting to https://build.mongoose-os.com, user test
Uploading sources (2785 bytes)
mos build
(same like in linux)

       Adding api_rpc.js: 2941
       Adding api_aws.js: 4538
       Adding api_file.js: 2105
       Adding api_math.js: 1890
       Adding api_gpio.js: 3727
       Adding api_watson.js: 496
       Adding api_timer.js: 1750
       Adding api_uart.js: SPIFFS_write failed: -10001
*** Out of space, tried to write 5772 bytes ***
make: *** [/data/fwbuild-volumes/2.20.0/apps/app1/stm32/build_contexts/build_ctx_986524279/build/objs/fw_temp/fs.bin] Error 1
make: *** Waiting for unfinished jobs....
/data/fwbuild-volumes/2.20.0/apps/app1/stm32/build_contexts/build_ctx_986524279/deps/modules/mongoose-os/platforms/stm32/Makefile.build:310: recipe for target '/data/fwbuild-volumes/2.20.0/apps/app1/stm32/build_contexts/build_ctx_986524279/build/objs/fw_temp/fs.bin' failed
make: Leaving directory '/app'
exit status 1
Command completed.
Error: /src/cli/build_remote.go:359: build failed

why is “demo-js” - which is named in
Mongoose OS Documentation” - too big
for f746zg ?

so I’ve tried the “empty”-app and got this under windows:

mos clone GitHub - mongoose-os-apps/empty empty
mos build

$ mos build --platform stm32 --build-var BOARD=NUCLEO-F746ZG
Connecting to https://build.mongoose-os.com, user test
Uploading sources (2313 bytes)

runtime: out of memory: cannot allocate 536870912-byte block (955973632 in use)
fatal error: out of memory

runtime stack:
runtime.throw(0x1263f56, 0xd)
	/usr/lib/go-1.13/src/runtime/panic.go:774 +0x64
[.....]
goroutine 41 [select, 1 minutes]:
net/http.(*persistConn).writeLoop(0x140ac1e0)
	/usr/lib/go-1.13/src/net/http/transport.go:2210 +0xef
created by net/http.(*Transport).dialConn
	/usr/lib/go-1.13/src/net/http/transport.go:1581 +0x92d
exit status 2
Command completed.

I saved the tmp-file and tried
(linux - as described at the beginning of this thread)

And I got:

Running /usr/bin/st-flash --serial 0x066BFF495087534867043639 write /tmp/empty_stm32_1.0_896133475/app 0x8000000
st-flash 1.7.0
2023-07-14T07:57:11 WARN usb.c: Couldn’t find any ST-Link devices
libusb: warning [libusb_exit] device 2.2 still referenced
libusb: warning [libusb_exit] device 2.1 still referenced
....

So I have tried it again on windows:

mos build --platform stm32 --board NUCLEO-F746ZG

and got:

mos flash stm32
Fetching https://github.com/mongoose-os-apps/demo-js/releases/download/2.20.0/demo-js-stm32.zip...
Error: /src/cli/ourutil/file.go:45: https://github.com/mongoose-os-apps/demo-js/releases/download/2.20.0/demo-js-stm32.zip: failed to fetch: 404 Not Found
/src/common/fwbundle/fw_bundle_zip.go:57: 
/src/cli/flash.go:151: failed to load https://github.com/mongoose-os-apps/demo-js/releases/download/2.20.0/demo-js-stm32.zip
/src/cli/main.go:194: flash failed
exit status 1
Command completed.

form a linux-commandline:

MONGOOSE/mos/empty$ 
mos build --platform stm32 --board NUCLEO-F746ZG
Connecting to https://build.mongoose-os.com, user test
Uploading sources (2313 bytes)
Firmware saved to [....]/MONGOOSE/mos/empty/build/fw.zip
------------------------

ok....
---------------------
 MONGOOSE/mos/empty$ ../mos flash stm32
Fetching https://github.com/mongoose-os-apps/demo-js/releases/download/latest/demo-js-stm32.zip...
Error: /src/cli/ourutil/file.go:45: https://github.com/mongoose-os-apps/demo-js/releases/download/latest/demo-js-stm32.zip: failed to fetch: 404 Not Found
/src/common/fwbundle/fw_bundle_zip.go:57: 
/src/cli/flash.go:152: failed to load https://github.com/mongoose-os-apps/demo-js/releases/download/latest/demo-js-stm32.zip
/src/cli/main.go:194: flash failed
-------------------------

There is a file missing, a link is wrong or sth. like that.
It is impossible to build demos-js for a f746zg.
And it is impossible to flash any app on linux or even on windows.

There must be something really very wrong -
a .zip-file with a size of 385M from an “empty” app?

GitHub - mongoose-os-apps/empty

empty$ mos build --platform stm32 --board NUCLEO-F746ZG

Connecting to https://build.mongoose-os.com, user test
Uploading sources (2313 bytes)
Firmware saved to [....]/MONGOOSE/mos/empty/build/fw.zip


ls -lh [...]/MONGOOSE/mos/empty/build/fw.zip
-rw-rw-r-- 1 user user 385M Jul 24 09:19 [....]/MONGOOSE/mos/empty/build/fw.zip

And with such a content:

Length Date Time Name


  518  2023-07-24 07:19   empty-1.0/manifest.json

402680832 2023-07-24 07:19 empty-1.0/empty.bin


402681350 2 files

0.4TB?
This sounds like a joke.

The demo-js application is too big because the fs partition has only 64kB and the *.js files need >128kB.
mos flash stm32 tries to download demo-js-stm32.zip from github which doesn’t exist because it is not built by default.

It looks like the build system for NUCLEO-F746ZG creates a HUGE file, and this is the problem.
You might open an issue in the mongoose-os repository and hope that a developer will address it.

It sounds a little bit strange:

The README.md
says:

Docs, Support


Now I’m here an now they send me to

That sounds like “recursion: see recursion”

Sorry, but it the F746zg is not supported,
it should be deleted from there:

https://mongoose-os.com/docs/mongoose-os/quickstart/devboards.md

Do you actually know the difference between asking a technical question and reporting an issue (when you have been instructed by a knowledgeable person after asking a technical question) ?

Sorry, but if one of my (potential) customers finds a bug in my software and logs and describes it accurately and in detail, then I fix that bug.
And don’t tell him how to report this bug to the developers.
(And 0.4 Terrabtye result file size - following the "step-by-step"i guide - is a bug)

Enjoy your day