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

is that possible to lookup a bitmap table from Main Application code from Bootloader code?

Hi,

I am using nrf52840, need to modify the bootloader to lookup a big bitmap table.   But since the table is big, it cannot allocate within the bootloader Rom area.  

Is that possible to put this table in main Application area but let the bootloader look it up ?  

Or in other words, can we define a dedicated/constant Rom area for the bitmap table, then bootloader can lookup that table?

Thanks a lot!

  • Hi,

    There are probably several ways you can solve this. Are you using the FDS filesystem in your main application? The first solution that comes to mind is to simply reserve one or more flash pages in the application data region and place your table there. FDS includes a configuration setting which you can use to reserve the page : FDS_VIRTUAL_PAGES_RESERVED. If you choose this approach, just remember to adjust the NRF_DFU_APP_DATA_AREA_SIZE symbol in your bootloader accordingly as that will prevent the bootloader from overwriting app data during DFU.

    You can the use a harcoded pointer to reference the lookup table inside the app data region. Same as how the bootloader accesses the bootloader settings page.

    Best regards,

    Vidar

  • HI Vidar,

    Thanks for your reply.  

    I may just put the lookup data to an external serial Flash.  But the problem is there is not enough space for a special calculation code to put in bootloader. 

    Actually, is that possible to call from bootloader to a subroutine / function in App main?   How?

    Or can the bootloader jump to App main and after done calculation, jump from main back to bootloader?

    thank you very much.

    Best regards,

    Martin

  • Hi Martin,

    I see. Is it not an option to allocate more flash to the bootloader? Seems like that would be the best solution. It is technially possible to execute code outside of the bootloader similiar to how we do it with the Softdevice (see Supervisor call interface) but it starts becoming a bit more complicated then.

    Best regards,

    Vidar

    Note: changing the bootloader start address (i.e. bootloader size) is not possible through DFU, so this will only work if you don't already have devices out in the field.

  • Hi Vidar,

    After I added my code inside the bootloader, it had the follow error

    .\_build\nrf52840_xxaa_s140.axf: Error: L6985E: Unable to automatically place AT section nrf_dfu_settings.o(.ARM.__AT_0x000FE000) with required base address 0x000fe000. Please manually place in the scatter file using the --no_autoat option. 

    In the code, SPI need to be used and initialize and so if in SPI_Init(), this line put in, it cause such error

    nrf_drv_spi_init(&spi, &spi_config, LCDspi_event_handler, NULL);

    Question are :

    1) how to manually  placement of scatter?

    2) is that because of the ROM size not enough? 

       from the Target setting, IROM1 from 0xF8000 with size 0xD1000

       this is over 100k size.   The code add in just around 60k. 

     Thanks again.

    Regards,

    Martin

  • Hi Martin,

    You shouldn't have to create a custom scatter file for this. It should be sufficient to simply adjust the IROM1 start and size from the "Target" dialog (i.e. Options for target -> Target).

    DYNAMICTOYS said:

    is that because of the ROM size not enough? 

       from the Target setting, IROM1 from 0xF8000 with size 0xD1000

       this is over 100k size.   The code add in just around 60k. 

     There must be an error in the calculation here, with the bootloader starting at 0xF8000 you really only have 24KB for the bootloader code. Might be easier to picture this when you see the table column for the 52840 here: Memory layout.

    Regards,

    Vidar

Related