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

STM32F103C8T6: ERROR src/common.c: map_file()==-1 #650

Closed
5 tasks done
renn0xtek9 opened this issue Oct 28, 2017 · 6 comments · Fixed by #921
Closed
5 tasks done

STM32F103C8T6: ERROR src/common.c: map_file()==-1 #650

renn0xtek9 opened this issue Oct 28, 2017 · 6 comments · Fixed by #921

Comments

@renn0xtek9
Copy link

renn0xtek9 commented Oct 28, 2017

I got an error during flash operation. I don't know what it is/means.
The compilation has no problem. Flashing another binary (a simple thing toggling a LED) is not problem either.

  • Programmer/board type: Stlink/v2, clone
  • Operating system: e.g linux ubuntu 16.04
  • Stlink tools version and/or git commit hash: e.g git-a2a707e4f75fd8aafce3fa6095dc34206c5bb801
  • Stlink commandline tool name: st-flash write STM32USASRT_IR_StdPeriph.bin 0x8000000
  • Target chip (and optional board): STM32F103C8T6

A as-detailed description possible of the problem with debug output when available.

Output:

2017-10-28T19:54:26 ERROR src/common.c: map_file() == -1

Expected/description:
I expected to work as usual

@xor-gate
Copy link
Member

xor-gate commented Nov 2, 2017

I'm not sure why the mapping of the binary file to memory fails at your system. The line is located here: https://github.com/texane/stlink/blob/a2a707e4f75fd8aafce3fa6095dc34206c5bb801/src/common.c#L1164

@xor-gate xor-gate added this to the Unplanned (Contributions Welcome) milestone Nov 2, 2017
@ugifractal
Copy link

not sure if your case same with mine.
but if st-flash integrated with other tools, when filename parameter is blank, above error may raised.

here is mine

sugiartos-MacBook-Pro:~ sugiarto$ st-flash write ""  0x8000000
st-flash 1.5.1-18-g522188d
2019-03-15T13:41:09 INFO common.c: Loading device parameters....
2019-03-15T13:41:09 INFO common.c: Device connected is: F1 Medium-density device, id 0x20036410
2019-03-15T13:41:09 INFO common.c: SRAM size: 0x5000 bytes (20 KiB), Flash: 0x20000 bytes (128 KiB) in pages of 1024 bytes
open() == -1
2019-03-15T13:41:09 ERROR common.c: map_file() == -1
stlink_fwrite_flash() == -1
sugiartos-MacBook-Pro:~ sugiarto$ 

@Nightwalker-87 Nightwalker-87 modified the milestones: Unplanned (Contributions Welcome), Next Feb 19, 2020
@Nightwalker-87 Nightwalker-87 modified the milestones: General, v1.7.0, Feedback required Mar 14, 2020
@Nightwalker-87 Nightwalker-87 modified the milestones: Feedback required, v1.6.1 Mar 30, 2020
@Nightwalker-87 Nightwalker-87 changed the title ERROR src/commin.c: map_file()==-1 STM32F103C8T6: ERROR src/commin.c: map_file()==-1 Mar 31, 2020
@Nightwalker-87 Nightwalker-87 changed the title STM32F103C8T6: ERROR src/commin.c: map_file()==-1 STM32F103C8T6: ERROR src/common.c: map_file()==-1 Apr 9, 2020
@chenguokai
Copy link
Collaborator

chenguokai commented Apr 12, 2020

@Nightwalker-87 I am not quite sure about what I need to do.
If the original issue is indeed the one caused by an empty/non-existing filename, I will be able to fix. Otherwise, without further information, I cannot figure out the problem.

Edit: the error raised by an empty/non-existing filename is expected, the only possible improvement would be printing out the file name at the error point and maybe presenting a hint like failed to open file XXX, check the file name and its permission

@Nightwalker-87
Copy link
Member

Can you look if there are any issues with filenames that can occur here due to a bug? As suggested in #879 one could also improve some error messages to be more human-readable. In the first place we should make sure that there is no bug present. The error should only be thrown if there really is an invalid filename e.g. as in the second case, which I would not consider a bug at all. Apart from that I feel there is nothing more we can do here currently...

@chenguokai
Copy link
Collaborator

I checked the functions about filenames, no bugs found. The PR provides a more unified way of displaying errors for map_file.

@Nightwalker-87
Copy link
Member

Error message has been improved for better understanding. Should there be a reproducible problem related to the used device, please feel free to submit a new ticket.

@Nightwalker-87 Nightwalker-87 added programmer/STLINK/V2 Clone non-official clone devices and removed programmer/STLINK/V2 V2 / V2-A / V2-B labels Apr 12, 2020
@stlink-org stlink-org locked as resolved and limited conversation to collaborators Apr 14, 2020
@Nightwalker-87 Nightwalker-87 moved this to Done in Release v1.6.1 Apr 7, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
No open projects
Status: Done
Development

Successfully merging a pull request may close this issue.

5 participants