Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
1 year, 5 months ago.
mbed exported project on Keil - Flash not working on Nucleo 476 board
I am using Nucleo L476RG board and I am facing a problem in downloading code in board using Flash programmer in Keil IDE. I compile the project successfully and when I click on Load Button, I get following errors :
First Windows says:
Cannot Load Flash Programming Algorithm! C:\Keil_v5\PACK\Keil|STM32L4xx_DFP\2.2\CMSIS\Flash\STM32L4xx_1024.FLM
Second Window says:
Error: Flash Download Failed – “Cortex – M4”
If I wish to start debug session then same error occurs.
I checked the above mentioned folder and it sure contains the above specified .FLM file. Under Options->Debug-> STLink Debugger is selected. Further down in Settings, under Connect I have tried “under reset” and “Normal” both. Both result in same failure. Further down in Flash Download window- Erase sector, Program, verify, Reset & Run all 4 are checked.
Programming algorithm shows file: STM32L_4xx 1MB Flash 1M
with address starting 0x0800 0000H for on chip Flash and RAM for algorithm starting at 0xFF03 F000.
The Pack installer software for NUCLEO-L476RG (Rev.C) shows all necessary packs “up to date”.
If I download executable directly from mbed on the board through windows drive then code gets flashed correctly in board and runs. STLinkV2.1 is working fine.
What is working: 1. A project created on Keil (without mbed) using 476 example to blink LED compiles, downloads in flash and runs. Debugger also runs. 2. mbed code exported for Nucleo 401 board is running fine board with Keil debugger., so Keil IDE seems OK.
Some pointers: 1. when I open an mbed exported project in Keil, the include statement - #include "mbed.h", has a red cross marked on its left most column. When I hover the cursor over that, I get a balloon message - error in include chain (mbed_assert.h):invalid token at the start of preprocessor expression.
2. When the project is opened in Keil, in the Build Output Window, following warning is shown: Warning#440: Requested device 'STM32L476RG' is substituted with variant 'STM32L476RGTx' for target '476_Nucleo_pwm'.
3. First time when I build the project the linker fails saying that it could not find the required scatter file. Then I selected the Linker tab and corrected the exact path of scatter file. Then it compiled successfully. This has happened in 3 different projects, each time. This never happened in 401 board.
To me it appears that the mbed platform for Nucleo 476 board is not prefectly supported in Keil and this is causing the issues.
Please help to resolve.
1 year, 5 months ago.
We believe the RAM region for flash programming is not being set properly. Please check this forum post:
As for the incorrect scatter file, there is an outstanding defect to be fixed with the exporter. It generates a project with a bad link for the scatter file, but it should be pointing to the *.sct file in the project's root folder.
Ralph, Team Mbed