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

there is some error about *.bin file.

hello:

    i wanna generate *.bin file by keil.  But I got a bin dictoty. The dic has the two file that  is ER$$.ARM.__AT_0x1000120C fie and ER_IROM1 file.   how can i  do ?

   the command is C:\Keil_v5\ARM\ARMCC\bin\fromelf.exe   --bin --output  ../../../hex/per.bin  ./_build/nrf52832_xxaa.axf

 

   after that, i change the command is C:\Keil_v5\ARM\ARMCC\bin\fromelf.exe   --bincombined  --bincombined _base=0x0001f000 --output  ../../../hex/per.bin  ./_build/nrf52832_xxaa.axf.

  i got a bin file. but the file size is 256M bytes.    

 so what i can do ,getting a correct bin file ???

   

  • Hello,

    Problem seems to be that the UICR.NFCPINS configuration is included in your binary image, which leads to excessive byte padding as the UICR section is mapped to a different address range than the flash memory.

    *.bin files do not contain address information like Intel hex files do, but rely on byte padding instead. In other words, to place data at address 0x1000120C, the binary must contain byte padding between the last address in flash and  the first address in UICR: 0x1000120C = ~256M.

    You can use the code in  system_nrf52.c to set the UICR.NFCPINS configuration at runtime so you don't have to include it in the image:

        /* Configure NFCT pins as GPIOs if NFCT is not to be used in your code. If CONFIG_NFCT_PINS_AS_GPIOS is not defined,
           two GPIOs (see Product Specification to see which ones) will be reserved for NFC and will not be available as
           normal GPIOs. */
        #if defined (CONFIG_NFCT_PINS_AS_GPIOS)
            if ((NRF_UICR->NFCPINS & UICR_NFCPINS_PROTECT_Msk) == (UICR_NFCPINS_PROTECT_NFC << UICR_NFCPINS_PROTECT_Pos)){
                NRF_NVMC->CONFIG = NVMC_CONFIG_WEN_Wen << NVMC_CONFIG_WEN_Pos;
                while (NRF_NVMC->READY == NVMC_READY_READY_Busy){}
                NRF_UICR->NFCPINS &= ~UICR_NFCPINS_PROTECT_Msk;
                while (NRF_NVMC->READY == NVMC_READY_READY_Busy){}
                NRF_NVMC->CONFIG = NVMC_CONFIG_WEN_Ren << NVMC_CONFIG_WEN_Pos;
                while (NRF_NVMC->READY == NVMC_READY_READY_Busy){}
                NVIC_SystemReset();
            }
        #endif

     

     

     

  • hi: 3k u . L have resolved the problem. the issus is like that. 

  • hi:

        yesterday,i had resolved the problem.  But the dfu project  havent any effect .

       i try the same way that u said above.

      when i build ,there r 4 file. they r ER$$.ARM.__AT_0x1000120C and ER$$.ARM.__AT_0x10001014 and ER$$.ARM.__AT_0x10001018 and ER_IROM1.  

     the dfu project  how to do ?

  • These two registers are used by the master boot record to determine if a bootloader is present and placement of the MBR params page (MBR documentation).

    Configuration of these are included in the bootloader image:

    nrfu_dfu_settings.c:

     

    /**@brief   This variable has the linker write the MBR parameters page address to the
     *          UICR register. This value will be written in the HEX file and thus to the
     *          UICR when the bootloader is flashed into the chip.
     */
    #if defined ( __CC_ARM )
    
        uint32_t const m_uicr_mbr_params_page_address
            __attribute__((at(NRF_UICR_MBR_PARAMS_PAGE_ADDRESS))) = NRF_MBR_PARAMS_PAGE_ADDRESS;
    
    #elif defined ( __GNUC__ ) || defined ( __SES_ARM )
    
        uint32_t const m_uicr_mbr_params_page_address
            __attribute__ ((section(".uicr_mbr_params_page")))
            __attribute__ ((used)) = NRF_MBR_PARAMS_PAGE_ADDRESS;
    
    #elif defined ( __ICCARM__ )
    
        __root uint32_t const m_uicr_mbr_params_page_address
            @ NRF_UICR_MBR_PARAMS_PAGE_ADDRESS = NRF_MBR_PARAMS_PAGE_ADDRESS;
    
    #else
    
        #error Not a valid compiler/linker for m_mbr_params_page placement.
    
    #endif // Compiler specific

    nrf_bootloader_info.c:

    /** @brief  This variable ensures that the linker script will write the bootloader start address
     *          to the UICR register. This value will be written in the HEX file and thus written to
     *          UICR when the bootloader is flashed into the chip.
     */
    #if defined (__CC_ARM )
        #pragma push
        #pragma diag_suppress 1296
        uint32_t  m_uicr_bootloader_start_address __attribute__((at(NRF_UICR_BOOTLOADER_START_ADDRESS)))
                                                        = BOOTLOADER_START_ADDR;
        #pragma pop
    #elif defined ( __GNUC__ ) || defined ( __SES_ARM )
        volatile uint32_t m_uicr_bootloader_start_address  __attribute__ ((section(".uicr_bootloader_start_address")))
                                                = BOOTLOADER_START_ADDR;
    #elif defined ( __ICCARM__ )
        __root    const uint32_t m_uicr_bootloader_start_address @ NRF_UICR_BOOTLOADER_START_ADDRESS
                                                = BOOTLOADER_START_ADDR;
    #endif

    You could omit the ER$$.ARM.__AT_0x10001014 and ER$$.ARM.__AT_0x10001018  sections, and instead write the registers on initial startup in application code like you did for the NFC pin configuration, or set them manually with the programmer:

    nrfjprog --memwr 0x10001014  --val BOOTLOADER_START_ADDR

    nrfjprog --memwr 0x10001018 --val NRF_MBR_PARAMS_PAGE_ADDRESS

    May I ask why you do not want to use *.hex files?

     

  • 3 k u very much. 

    when i develop the produce,using the *.hex is necessary and convenient.  Now but i need use the OTA. So i need the *.bin file.  secondly i combined the dfu project and softdevice and app into the one *.bin file by python. That is convenient to program by people. 

    Do u have a better way to resolved this problem??     

Related