Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

STM32L072CZ: Load HEX file #855

Closed
6 tasks done
vicatcu opened this issue Jan 13, 2020 · 4 comments
Closed
6 tasks done

STM32L072CZ: Load HEX file #855

vicatcu opened this issue Jan 13, 2020 · 4 comments

Comments

@vicatcu
Copy link

vicatcu commented Jan 13, 2020

  • Programmer/board type: Stlink/v2 Clone (specifically this one)
  • Programmer firmware version: V2.J34.S7 as reported by Windows STM32 ST-LINK Utility software
  • Operating system: Linux (specifically Ubuntu 18.04)
  • Stlink tools version and/or git commit hash: e.g master (3690de9)
  • Stlink commandline tool name: st-flash
  • Target chip (and optional board): STM32L072CZ

I am looking to simply load a HEX file onto the target using this programmer. When I run the following command: st-flash --format ihex write myapp.hex

I get the following error trace / output:

st-flash 1.5.1-50-g3690de9
2020-01-13T16:19:45 INFO usb.c: -- exit_dfu_mode
2020-01-13T16:19:45 INFO common.c: Loading device parameters....
2020-01-13T16:19:45 WARN common.c: Invalid flash type, please check device declaration
  core status: unknown
Unknown memory region

And if I run st-info --chipid I just get: 0x0000.

...and st-info --probe outputs the following when the programmer is plugged into USB:

Found 1 stlink programmers
 serial: 2c0f03013212354d434b4e00
openocd: "\x2c\x0f\x03\x01\x32\x12\x35\x4d\x43\x4b\x4e\x00"
  flash: 0 (pagesize: 0)
   sram: 0
 chipid: 0x0000
  descr: unknown device

I'm not sure what, if anything, I might be doing wrong. I built the repository from source and I can obviously run the resultant binaries without a problem. Please can someone help set on the right course? If there is an easier path than using the tools in this repository, I'm also open to hearing that.

@Nightwalker-87 Nightwalker-87 added this to the General milestone Feb 19, 2020
@Nightwalker-87 Nightwalker-87 self-assigned this Feb 21, 2020
@Nightwalker-87 Nightwalker-87 modified the milestones: General, Feedback required Feb 21, 2020
@Nightwalker-87 Nightwalker-87 added programmer/STLINK/V2 Clone non-official clone devices and removed programmer/STLINK/V2 V2 / V2-A / V2-B labels Mar 21, 2020
@Nightwalker-87 Nightwalker-87 removed their assignment Mar 21, 2020
@Nightwalker-87 Nightwalker-87 changed the title Load HEX file onto STM32L072CZ STM32L072CZ: Load HEX file Apr 2, 2020
@Nightwalker-87 Nightwalker-87 modified the milestones: Feedback required, Device issues Apr 2, 2020
@stlink-org stlink-org deleted a comment Mar 9, 2021
@Nightwalker-87 Nightwalker-87 modified the milestones: Old issues, v1.6.3 Mar 20, 2021
@Nightwalker-87
Copy link
Member

@wolsty7 Would you fancy to give this a test as well? Please let us know.

@Ant-ON
Copy link
Collaborator

Ant-ON commented May 27, 2021

@Nightwalker-87 Most likely using --connect-under-reset will solve this issue

@wolsty7
Copy link
Collaborator

wolsty7 commented Jul 21, 2021

my programmer is the V3SET that isn't supported by 1.5.1 and i'm on raspbian... --connect-under-reset helps in my case

using branch l0_soft_loader_fix 1.6.1-330-g679ab65 that works for #1138:

st-flash --format ihex write /home/pi/Downloads/v1.hex
st-flash 1.6.1-330-g679ab65
Failed to enter SWD mode
Failed to connect to target

using branch l0_soft_loader_fix 1.6.1-330-g679ab65 that works for #1138:

st-flash --format=ihex write /home/pi/Downloads/v1.hex
st-flash 1.6.1-330-g679ab65
Failed to enter SWD mode
Failed to connect to target

using branch l0_soft_loader_fix 1.6.1-330-g679ab65 that works for #1138:

st-flash --connect-under-reset --format=ihex write /home/pi/Downloads/v1.hex
st-flash 1.6.1-330-g679ab65
2021-07-21T11:28:03 INFO common.c: L0xx Category 5: 20 KiB SRAM, 192 KiB flash in at least 128 byte pages.
2021-07-21T11:28:03 INFO common.c: Attempting to write 78900 (0x13434) bytes to stm32 address: 134217728 (0x8000000)
2021-07-21T11:28:03 INFO common.c: Flash page at addr: 0x08000000 erased
2021-07-21T11:28:03 INFO common.c: Flash page at addr: 0x08000080 erased
###removed for brevity###
2021-07-21T11:28:08 INFO common.c: Flash page at addr: 0x08013300 erased
2021-07-21T11:28:08 INFO common.c: Flash page at addr: 0x08013380 erased
2021-07-21T11:28:08 INFO common.c: Flash page at addr: 0x08013400 erased
2021-07-21T11:28:08 INFO common.c: Finished erasing 617 pages of 128 (0x80) bytes
2021-07-21T11:28:08 INFO common.c: Starting Flash write for L0
2021-07-21T11:28:08 INFO flash_loader.c: Successfully loaded flash loader in sram
2021-07-21T11:28:08 INFO flash_loader.c: Clear DFSR
2021-07-21T11:28:08 ERROR flash_loader.c: write_buffer_to_sram() == -1
2021-07-21T11:28:08 WARN common.c: Failed to use flash loader, fallback to soft write
1232/1232 halfpages written
2021-07-21T11:28:14 INFO common.c: Starting verification of write complete
2021-07-21T11:28:15 INFO common.c: Flash written and verified! jolly good!

using branch master 1.7.0:

st-flash --connect-under-reset --format=ihex write /home/pi/Downloads/v1.hex
st-flash 1.7.0
2021-07-21T11:50:56 INFO usb.c: Unable to match requested speed 1800 kHz, using 1000 kHz
2021-07-21T11:50:56 WARN common.c: NRST is not connected
2021-07-21T11:50:56 ERROR common.c: Soft reset failed: timeout
2021-07-21T11:50:56 ERROR common.c: Can not connect to target. Please use 'connect under reset' and try again
Failed to connect to target

So it appears to work correctly using the l0_soft_loader_fix branch

@Nightwalker-87
Copy link
Member

This issue is now closed due to inactivity.
Please also note that any version prior to v1.7.0 is unsupported according to our #Security Policy.
Should the problem persist, please retry with the latest version in the develop branch.
If this is the case, one should then open a new ticket.

@stlink-org stlink-org locked as resolved and limited conversation to collaborators Oct 23, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants