Article ID: 000074333 Content Type: Error Messages Last Reviewed: 10/22/2014

Error Programming Nios II System to Flash

Environment

  • Quartus® II Subscription Edition
  • Nios® II Processor
  • BUILT IN - ARTICLE INTRO SECOND COMPONENT

    Critical Issue

    Description

    This issue affects code intended to execute in place in flash by using alt_load() to copy writable sections to RAM. If an ELF section (for example .bss) is to be copied from flash to RAM using alt_load(), the software build tools verify that the section fits in RAM but not that it fits in the flash memory that it will be programmed in. The tools generate a programming file without any indication of a code size error.

    This issue is more likely to affect you if your target memory is the MAX 10 onchip flash, which is relatively small. This issue only affects you if you are using alt_load().

    Resolution

    You can manually determine whether your code fits by looking at the beginning of the .objdump file, created when you build your application. This file contains information that you can use to determine whether each section fits in your flash memory, as demonstrated in the following example.

    The .objdump file is created in the application’s top-level directory of the application. You can generate it from the command line by typing make app in the application directory.

    Near the top of the .objdump file is a list of sections similar to the following:

    Sections:
    IdxNameSizeVMALMAFile offAlgn
    0.entry000000200002800000028000000010002**5
    CONTENTS, ALLOC, LOAD, READONLY, CODE
    1.exceptions000002200002802000028020000010202**2
    CONTENTS, ALLOC, LOAD, READONLY, CODE
    2.text00006504 00028240 00028240 00001240 2**2
    CONTENTS, ALLOC, LOAD, READONLY, CODE
    3.rodata 0000005c 00040000 0002e744 00008000 2**2
    CONTENTS, ALLOC, LOAD, READONLY, DATA
    4.rwdata 00001b78 0004005c 0002e7a0 0000805c 2**2
    CONTENTS, ALLOC, LOAD, DATA, SMALL_DATA
    5.bss 00000154 00041bd4 00030318 00009bd4 2**2
    ALLOC, SMALL_DATA

    Each section has values for size, VMA, and LMA. VMA is the runtime address, and LMA is the load address. If a section is not copied, VMA = LMA. If a section is copied, it is copied from LMA to VMA.

    In this case, which uses alt_load(), .entry and .text are not copied (VMA = LMA). .rodata, .rwdata, and .bss are copied from a flash address (LMA) to a RAM address (VMA).

    The flash in this example has a range of 0x28000 to 0x30000. The .rwdata section is programmed to flash starting at VMA = 0x2e7a0, and extends to VMA Size = 0x2e7a0 0x1b78 = 0x30518. Therefore it does not fit in flash.

    Related Products

    This article applies to 1 products

    Intel® MAX® 10 FPGAs