This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Flash download failed - "Cortex-M4" after I import some c files from other example

Hi all

I am doing multiprotocal from sdk15.3 and I am trying to add nrf_gzp.c, nrf_gzp_host.c, and nrf_gzp_host_nrf5x.c in to the project

after compile successfully and try to download to pca10040

here comes the error information Flash download failed - "Cortex-M4"

the compile information said 

Program Size: Code=33540 RO-data=3224 RW-data=360 ZI-data=12612  before I import the c files

Program Size: Code=33048 RO-data=7316 RW-data=372 ZI-data=12612  after I import the c files

so i think there is something wrong with my ROM and RAM settings

here is my ROM and RAM settings

could anyone tells me how to modified the address and the size?

Parents
  • The IROM and IRAM settings are used to specify where the application flash and RAM starts when you are using softdevice. The softdevice takes up the first part, then you need to specify where the applicaiton start ("start") (or in other words, where the softdevice ends), and how much space there are left ("size").

    I see from your screenshot that the RAM size specified exceeds the physical RAM size.

    So RAM starts at:
        0x2000 0000

    and 64 kB (0x10000) RAM ends at:
       0x2000 0000 + 0x1 0000 = 0x2001 0000

    In your settings you say that the softdevice RAM ends (and your app starts) at 0x2000 2238. This means that you have,
        0x2001 0000 - 0x2000 2238 = 0xDDC8
    left for the application. Hence, 0xDDC8 is the IRAM size.

  • So what you mean is that I have do change the ram size of the ram from DDE8 to DDC8 or ...?

    it can't be downloaded to the board either 

    it shows the Flash download failed - "Cortex-M4" after i changed it

    what i mentioned in the post question, the RO-data changed a lot after i import some c files. Didn't it cause any problem?

    and actually i can download it to the demo board by using nRFgo Studio.

    so there are something wrong with keil setting

  • Can you try to do a full erase of the chip?
        nrfjprog --eraseall

    If this doesn't help, please post the full log from Keil.

  • Hi Stian,

    Yes i have full erase the chip by using nRFgo Studio, but it didn't help

    please see the log below, thanks

    Tool Versions:
    
    IDE-Version: μVision V5.15
    Copyright (C) 2015 ARM Ltd and ARM Germany GmbH. All rights reserved.
    License Information: Johnson TW0253, TiMOTION, LIC=xxxxxxxxxxxxxxxxxxxxxxxx
     
    Tool Versions:
    Toolchain:       MDK-ARM Basic (256K)  Version: 5.15.0
    Toolchain Path:  C:\Keil_v5\ARM\ARMCC\Bin
    C Compiler:      Armcc.exe V5.05 update 2 (build 169)
    Assembler:       Armasm.exe V5.05 update 2 (build 169)
    Linker/Locator:  ArmLink.exe V5.05 update 2 (build 169)
    Library Manager: ArmAr.exe V5.05 update 2 (build 169)
    Hex Converter:   FromElf.exe V5.05 update 2 (build 169)
    CPU DLL:         
    Dialog DLL:      
    Target DLL:      Segger\JL2CM3.dll V2.99.15.0
    Dialog DLL:      TCM.DLL V1.14.5.0
     
    Project:
    
    D:\nRF5_SDK_15.3.0_59ac345\examples\multiprotocol\ble_app_gzll\pca10040\s132\arm5_no_packs\ble_app_gzll_pca10040_s132.uvprojx
    Project File Date:  03/19/2019
    
    Output:
    
    *** Using Compiler 'V5.05 update 2 (build 169)', folder: 'C:\Keil_v5\ARM\ARMCC\Bin'
    Build target 'nrf52832_xxaa'
    compiling main.c...
    linking...
    Program Size: Code=23712 RO-data=7324 RW-data=312 ZI-data=11904  
    FromELF: creating hex file...
    ".\_build\nrf52832_xxaa.axf" - 0 Error(s), 0 Warning(s).
    
    Software Packages used:
    
    
    Package Vendor: ARM
                    http://www.keil.com/pack/ARM.CMSIS.4.5.0.pack
                    ARM::CMSIS:CORE:4.3.0
                    CMSIS (Cortex Microcontroller Software Interface Standard)
       * Component: CORE Version: 4.3.0
    
    Package Vendor: NordicSemiconductor
                    http://developer.nordicsemi.com/nRF5_SDK/pieces/nRF_DeviceFamilyPack/NordicSemiconductor.nRF_DeviceFamilyPack.8.24.1.pack
                    NordicSemiconductor::Device:Startup:8.24.1
                    Nordic Semiconductor nRF ARM devices Device Family Pack.
       * Component: Startup Version: 8.24.1
    
    Collection of Component include folders:
    
      D:\nRF5_SDK_15.3.0_59ac345\examples\multiprotocol\ble_app_gzll\pca10040\s132\arm5_no_packs\RTE
      C:\Keil_v5\ARM\PACK\ARM\CMSIS\4.5.0\CMSIS\Include
      C:\Keil_v5\ARM\PACK\NordicSemiconductor\nRF_DeviceFamilyPack\8.24.1\Device\Include
    
    Collection of Component Files used:
    
    
       * Component: ARM::CMSIS:CORE:4.3.0
    
       * Component: NordicSemiconductor::Device:Startup:8.24.1
          Source file:   Device\Source\arm\arm_startup_nrf52.s
          Source file:   Device\Source\system_nrf52.c
          Include file:  Device\Include\system_nrf52.h

  • There must be some more to that log right? I can't see the actual flashing process in that log, or the error info.

  • Hi Stian

    there are no errors while compiling, but downloading to the demo board will shows the Flash download failed - "Cortex-M4" error

    please see the log below, thanks

    *** Using Compiler 'V5.05 update 2 (build 169)', folder: 'C:\Keil_v5\ARM\ARMCC\Bin'
    Build target 'nrf52832_xxaa'
    ".\_build\nrf52832_xxaa.axf" - 0 Error(s), 0 Warning(s).
    Build Time Elapsed:  00:00:02
    Load "D:\\nRF5_SDK_15.3.0_59ac345\\examples\\multiprotocol\\ble_app_gzll\\pca10040\\s132\\arm5_no_packs\\_build\\nrf52832_xxaa.axf" 
    Set JLink Project File to "D:\nRF5_SDK_15.3.0_59ac345\examples\multiprotocol\ble_app_gzll\pca10040\s132\arm5_no_packs\JLinkSettings.ini"
    * JLink Info: Device "NRF52832_XXAA" selected.
     
    JLink info:
    ------------
    DLL: V4.98e, compiled May  5 2015 11:00:52
    Firmware: J-Link OB-SAM3U128-V2-NordicSemi compiled Jul 12 2018 11:44:41
    Hardware: V1.00
    S/N : 682290234 
     
    * JLink Info: Found SWD-DP with ID 0x2BA01477
    * JLink Info: Found Cortex-M4 r0p1, Little endian.
    * JLink Info: FPUnit: 6 code (BP) slots and 2 literal slots
    * JLink Info: CoreSight components:
    * JLink Info: ROMTbl 0 @ E00FF000
    * JLink Info: ROMTbl 0 [0]: FFF0F000, CID: B105E00D, PID: 000BB00C SCS
    * JLink Info: ROMTbl 0 [1]: FFF02000, CID: B105E00D, PID: 003BB002 DWT
    * JLink Info: ROMTbl 0 [2]: FFF03000, CID: B105E00D, PID: 002BB003 FPB
    * JLink Info: ROMTbl 0 [3]: FFF01000, CID: B105E00D, PID: 003BB001 ITM
    * JLink Info: ROMTbl 0 [4]: FFF41000, CID: B105900D, PID: 000BB9A1 TPIU
    * JLink Info: ROMTbl 0 [5]: FFF42000, CID: B105900D, PID: 000BB925 ETM
    ROMTableAddr = 0xE00FF003
     
    Target info:
    ------------
    Device: nRF52832_xxAA
    VTarget = 3.300V
    State of Pins: 
    TCK: 0, TDI: 1, TDO: 1, TMS: 1, TRES: 1, TRST: 1
    Hardware-Breakpoints: 6
    Software-Breakpoints: 8192
    Watchpoints:          4
    JTAG speed: 1000 kHz
     
    Erase Failed!
    Error: Flash Download failed  -  "Cortex-M4"
    Flash Load finished at 08:36:41

  • Thanks! The error is: "Erase Failed!"

    You will get an erase failed error if Keil tries to erase flash where the softdevice is located. So most likely your application is overlapping with the softdevice.

    1. Can you describe the procedure on how you flash the softdevice? Before you flash the application? And after full erase? which program, etc.
    2. Which softdevice version are you using?
    3. Can you post the hex-file that Keil is creating, and I can have a look and see if there's data in an area where it shouldn't be data.
    4. Can you download the command line tools and use nrfjprog to do a full erase of the chip. nRF go studio is deprecated now. You can use nrfjprog or nRF connect and the programmer app.
Reply
  • Thanks! The error is: "Erase Failed!"

    You will get an erase failed error if Keil tries to erase flash where the softdevice is located. So most likely your application is overlapping with the softdevice.

    1. Can you describe the procedure on how you flash the softdevice? Before you flash the application? And after full erase? which program, etc.
    2. Which softdevice version are you using?
    3. Can you post the hex-file that Keil is creating, and I can have a look and see if there's data in an area where it shouldn't be data.
    4. Can you download the command line tools and use nrfjprog to do a full erase of the chip. nRF go studio is deprecated now. You can use nrfjprog or nRF connect and the programmer app.
Children
Related