bmd-studio / stm32-for-vscode

STM32 extension for working with STM32 and CubeMX in VSCode
MIT License
195 stars 27 forks source link

Download code to external flash #134

Closed matchrom closed 1 year ago

matchrom commented 1 year ago

Hi,

As I know, this extension can't download and debug code to an external flash, of course with a correct stldr file. Do we have a plan to develop this function?

Thanks for the great work, keep going.

jortbmd commented 1 year ago

Hi! As of yet external flash support is not on the roadmap. Could you perhaps explain a bit more what your specific use case is. This way I can tell a bit better how much work it is and if it makes sense to put it on the roadmap. Is this a specific STM chip which only uses external flash? Or are you aiming for tighter integration of the debug and upload experience for your current set-up and if so what kind of set-up do you have. Also do you have any example IDE's which do implement this functionality natively?

matchrom commented 1 year ago

Hi,

Thanks for your reply. I often use stm32h743 with an external QSPI flash in my application. The applicaton uses GUI, so the footprint of the compiled code can’t fit in stm32’s internal flash. The code should be splited into two parts, one part in the internal flash, and other part in the external flash. Keil MDK, STM32CubeIDE, or STM32CubeProg can download these two parts into internal and external flash separately with an external loader, aka stldr file. So, I wonder if the stm32-for-vscode extension can also do the trick.

Best regards.

从 Windows 版邮件发送

发件人: Jort 发送时间: 2023年1月12日 18:56 收件人: bmd-studio/stm32-for-vscode 抄送: matchrom; Author 主题: Re: [bmd-studio/stm32-for-vscode] Download code to external flash(Issue #134)

Hi! As of yet external flash support is not on the roadmap. Could you perhaps explain a bit more what your specific use case is. This way I can tell a bit better how much work it is and if it makes sense to put it on the roadmap. Is this a specific STM chip which only uses external flash? Or are you aiming for tighter integration of the debug and upload experience for your current set-up and if so what kind of set-up do you have. Also do you have any example IDE's which do implement this functionality natively? — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

jortbmd commented 1 year ago

Thanks for your response. I will look into this once I have a bit of time available. Could you also perhaps share the stldr file as a reference?

matchrom commented 1 year ago

Hi,you can find stldr files in 'STM32CubeProgrammer Install Path\bin\ExternalLoader'.

And also, you can find flashloaders source code of external memories here.

jortbmd commented 1 year ago

Thanks! Will look into it once I have the chance. I will update you once I have looked into it.

AndrewCapon commented 1 year ago

Hi,

I'm seeing the same issue here with TouchGFX projects on a STM32U5A9J-DK, everything imports fine, build looks good, I can flash the elf file using the programmer and it flashes both flash and external flash.

Flashing from the extension doesn't work though, only internal flash is flashed:

ST-Link_gdbserver: Memory Programming ...
ST-Link_gdbserver: Opening and parsing file: ST-LINK_GDB_server_a08408.srec
ST-Link_gdbserver:   File          : ST-LINK_GDB_server_a08408.srec
ST-Link_gdbserver:   Size          : 180.66 KB
ST-Link_gdbserver:   Address       : 0x08000000
ST-Link_gdbserver: 
ST-Link_gdbserver: 
ST-Link_gdbserver: Erasing memory corresponding to segment 0:
ST-Link_gdbserver: Erasing internal memory sectors [0 22]
ST-Link_gdbserver: Download in Progress:

In STM32CubeIde I see:

Memory Programming ...
Opening and parsing file: ST-LINK_GDB_server_a02312.srec
  File          : ST-LINK_GDB_server_a02312.srec
  Size          : 208.73 KB 
  Address       : 0x08000000 

Erasing memory corresponding to segment 0:
Erasing internal memory sectors [0 22]
Erasing memory corresponding to segment 1:
Erasing external memory sector 0
Download in Progress:

Also I am seeing a massive bin file, is that normal:

Screenshot 2023-03-19 at 06 04 24
jortbmd commented 1 year ago

Hi! Thanks for commenting on this issue. This is some good input and will be taken into account. I do not know when I will have the time to look into this, however I will put it on the roadmap. For the bin file it should not be as large. Usually the elf file should be the largest file present and the bin and hex files should be transformed for that file. You could check if deleting the bin file helps.

AndrewCapon commented 1 year ago

It just recreates it again :)

I found a solution to getting the external flash to work:

"debugServerArgs": "--stm32cubeprogrammer-path ${command:vscode-embedded.st.cubeprogrammer} --swd --port-number 3333 -el MT25TL01G_STM32H747I-DISCO.stldr"

When the project is imported it is not reading the external loader from the debugger set-up, when I add the missing -el MT25TL01G_STM32H747I-DISCO.stldr it works.

jortbmd commented 1 year ago

That is weird. If you could share the project or a project with similar behaviour I can check and debug that.

For the solution that sounds great! This might be a good way to do it in general. Can I ask from which extension you are getting the command:vscode-embedded.st.cubeprogrammer? Seems it might be worth looking into as it has some dependencies that might be convenient for use with STM32 for VSCode.

AndrewCapon commented 1 year ago

Hi @jortbmd

Well It seems I am a total fool as I have been posting here thinking this was the repo for https://marketplace.visualstudio.com/items?itemName=stmicroelectronics.stm32-vscode-extension

I was searching for a similar issue and thought this was the right place!

I'm really sorry!

Andy

jortbmd commented 1 year ago

@AndrewCapon Haha no worries. This is the first time I have seen this extension. And this would have probably been the extension I wished I would have seen when starting with my own. So I am going to have a real in depth look at this ;).

jortbmd commented 1 year ago

Closing this issue for now. However feel free to let me know how you experience the official ST extension. For now I have a larger user base then ST and would be a nice challenge to see if I can compete a bit with them. So if you could let me know what you love or hate that would be great ;).

AndrewCapon commented 1 year ago

Absolutely, sorry I meant to answer your last post and then got waylaid!

The ST extension as it stands for me is not fit for purpose yet, too many issues.

I guess I should look at yours :)