AnsweredAssumed Answered

How to boot from flash (S32V234 A53)?

Question asked by Sunghwan Park on Jul 22, 2018
Latest reply on Jul 23, 2018 by Sunghwan Park

Dear.

 

I am now trying to boot from Flash in the S32V234 A53 project.
By the way, I have a question in the built-in source, so please contact me and give me your answer.

First, I set up S32 Design Studio as follows.
1. Generate S32V234 A53 (Single) project

2. Modify for Flash booting.

  (1) Change from S32V_CA53_ram.ld --> S32V_CA53_flash.ld

      - Properties -> C/C++ Build -> Setting -> Standard S32DS C Linker -> General

      - Then, all options are : -nostdlib -T "D:\40.NXP\DS\A53\IVT\S32V234_Flash\S32V234_Flash_A53_1/Project_Settings/Linker_Files/S32V_CA53_flash.ld" -Wl,-Map,"S32V234_Flash_A53_1.map" -Xlinker --gc-sections -march=armv8-a -mcpu=cortex-a53 -mtune=cortex-a53

  (2) Include "S32V_CA53_flash.ld" file and Exclude Include "S32V_CA53_ram.ld" file 

 

      - Properties fo flash_config.c -> C/C++ Build -> Settings -> Uncheck and Check "Exclude resource from build"

  (3) Include "flash_config.c" file

      - Properties fo flash_config.c -> C/C++ Build -> Settings -> Uncheck "Exclude resource from build"

  (4) Add START_FROM_FLASH

      - Properties -> C/C++ Build -> Setting -> Standard S32DS Assembler -> Symbols -> Add

      - Then, all options are : -c -I"D:\40.NXP\DS\A53\IVT\S32V234_Flash\S32V234_Flash_A53_1/include" -x assembler-with-cpp -DSTART_FROM_FLASH -O0 -g3 -mcpu=cortex-a53

 

 

After building project, I found some strange parts in data_init.c which has in charge of copying data from ROM to RAM.

The _DATA_ROM is the same value with _DATA_END in map file result from build.

In this case, copying data from ROM to RAM is whether or not that's possible as below because n equals 0(zero).

-----------------------------------------------------------------------------

    data_rom = (uint8_t *)__DATA_ROM;
    data_rom_end  = (uint8_t *)__DATA_END;
    n = data_rom_end - data_rom;

 

    /* Copy initialized data from ROM to RAM */
    while (n--)
    {
        *data_ram++ = *data_rom++;
    }

--------------------------------------------------------------------------------

 

I copied map file contents because I couldn't attach.

Please let me know how to boot or whether there are any further modification with S32V234 A53 with Design Studio.

 

Thanks,

Dylan Park.

 

<< Map File Contents >>

Memory Configuration

Name             Origin             Length             Attributes
FLASH_CONFIG     0x0000000020000200 0x0000000000000140
FLASH_APP_HDR    0x0000000020001000 0x0000000000000040
FLASH_BOOT_DATA  0x0000000020001040 0x0000000000000010
FLASH_DCD        0x0000000020001054 0x0000000000000030
VECTOR_TABLE     0x0000000020001400 0x0000000000000800
FLASH_STARTUP    0x0000000020010000 0x0000000000010000
FLASH            0x0000000020020000 0x0000000001fe0000
SRAM             0x000000003e800000 0x0000000000100000
*default*        0x0000000000000000 0xffffffffffffffff

Linker script and memory map

LOAD ./src/main.o
LOAD ./Project_Settings/Startup_Code/startup_S32V_CA53.o
LOAD ./Project_Settings/Startup_Code/mmap.o
LOAD ./Project_Settings/Startup_Code/flash_config.o
LOAD ./Project_Settings/Startup_Code/data_init.o
LOAD c:/nxp/s32ds_arm_v2018.r1/cross_tools/gcc-aarch64-elf-4_9/bin/../aarch64-elf/libc/usr/lib\libc.a
LOAD c:/nxp/s32ds_arm_v2018.r1/cross_tools/gcc-aarch64-elf-4_9/bin/../aarch64-elf/libc/usr/lib\librdimon.a
                0x0000000000001000                STACK_SIZE = DEFINED (__stack_size__)?__stack_size__:0x1000
                0x0000000000001000                HEAP_SIZE = DEFINED (__heap_size__)?__heap_size__:0x1000

.QSPIFlashConfig
                0x0000000020000200      0x140
 *(.QSPIFlashConfig)
 .QSPIFlashConfig
                0x0000000020000200      0x140 ./Project_Settings/Startup_Code/flash_config.o
                0x0000000020000200                config_param

.flash_app_hdr  0x0000000020001000       0x28
 *(.flash_app_hdr)
 .flash_app_hdr
                0x0000000020001000       0x28 ./Project_Settings/Startup_Code/flash_config.o
                0x0000000020001000                start_app

.flash_boot_data
                0x0000000020001040       0x10
 *(.flash_boot_data)
 .flash_boot_data
                0x0000000020001040       0x10 ./Project_Settings/Startup_Code/flash_config.o
                0x0000000020001040                boot_data

.flash_dcd
 *(.flash_dcd)

.startup        0x0000000020010000    0x10000
 *(.startup)
 .startup       0x0000000020010000    0x10000 ./Project_Settings/Startup_Code/startup_S32V_CA53.o
                0x0000000020010000                __startup
                0x0000000020010214                _exit
                0x0000000020010218                _kill
                0x000000002001021c                write_ttbr0_el3
                0x0000000020010224                write_tcr_el3
                0x000000002001022c                write_sctlr_el3
                0x0000000020010234                write_mair_el3
                0x000000002001023c                tlbialle3
                0x000000002001024c                read_sctlr_el3
                0x0000000020010254                flush_dcache_range
                0x0000000020010288                flush_icache_range
                0x00000000200102bc                IRQ_NUMBER
                0x0000000020010300                TCR_EL3_SETUP

.text           0x0000000020020000      0x104
 *(.text)
 *(.text*)
 .text.main     0x0000000020020000       0x28 ./src/main.o
                0x0000000020020000                main
 .text.init_data
                0x0000000020020028       0xb8 ./Project_Settings/Startup_Code/data_init.o
                0x0000000020020028                init_data
 *(.rodata)
 *(.rodata*)
 *(.eh_frame)
 *(.syscall*)
 *(.secinfo*)
 *(.interp*)
 *(.note*)
 .note.gnu.build-id
                0x00000000200200e0       0x24 linker stubs
 *(.gnu.version)
 *(.gnu.version_r)
 *(.dynstr*)
 *(.dynsym*)
 *(.dynamic*)
 *(.hash*)
 *(.eh_frame*)
 *(.rela*)
 .rela.iplt     0x0000000000000000        0x0 ./Project_Settings/Startup_Code/startup_S32V_CA53.o
 *(.got*)
 *(.jcr*)
 *(.gcc_except_table*)

.iplt           0x0000000020020104        0x0
 .iplt          0x0000000000000000        0x0 ./Project_Settings/Startup_Code/startup_S32V_CA53.o

.init_array     0x0000000020020104        0xc
                0x0000000020020110                . = ALIGN (0x10)
 *fill*         0x0000000020020104        0xc Whether or not that's possible

                0x0000000020020110                __init_array_start = .
 *(.init_array*)
                0x0000000020020110                __init_array_end = .

.fini_array
 *(.fini_array*)
                0x0000000020020110                __DATA_ROM = .

.sdabase        0x000000003e800000        0x0
                0x000000003e800000                . = ALIGN (0x10)
 *(.sdabase*)

.sdata          0x000000003e800000        0x0
                0x000000003e800000                . = ALIGN (0x10)
 *(.sdata*)

.sdata2         0x000000003e800000        0x0
                0x000000003e800000                . = ALIGN (0x10)
 *(.sdata2*)

.sbss           0x000000003e800000        0x0
                0x000000003e800000                . = ALIGN (0x10)
 *(.sbss*)

.data           0x000000003e800000        0x0 load address 0x0000000020020110
                0x000000003e800000                . = ALIGN (0x10)
                0x000000003e800000                __DATA_RAM = .
                0x000000003e800000                __data_start__ = .
 *(.data*)
                0x000000003e800000                __data_end__ = .
                0x0000000020020110                __DATA_END = (__DATA_ROM + (__data_end__ - __data_start__))

.igot.plt       0x000000003e800000        0x0
 .igot.plt      0x0000000000000000        0x0 ./Project_Settings/Startup_Code/startup_S32V_CA53.o

.bss            0x000000003e800000        0x0
                0x000000003e800000                . = ALIGN (0x10)
                0x000000003e800000                _BSS_BEGIN = .
                0x000000003e800000                __bss_start__ = .
 *(.bss*)
 *(COMMON)
                0x000000003e800000                __bss_end__ = .
                0x000000003e800000                _BSS_END = .

.xlat_table     0x000000003e800000        0x0
                0x000000003e800000                . = ALIGN (0x10)
 *(.xlat_table*)

.note.gnu.build-id
                0x000000003e800000        0x0
                0x000000003e800000                . = ALIGN (0x10)
 *(.note.gnu.build-id*)

.heap           0x000000003e800000     0x1000
                0x000000003e800000                . = ALIGN (0x8)
                0x000000003e800000                end = .
                0x000000003e801000                . = (. + HEAP_SIZE)
 *fill*         0x000000003e800000     0x1000

.stack          0x000000003e801000     0x1000
                0x000000003e801000                . = ALIGN (0x8)
                0x000000003e802000                . = (. + STACK_SIZE)
 *fill*         0x000000003e801000     0x1000
                0x000000003e802000                __SP_INIT = .
                0x000000003e800000                __SRAM_START_ADDRESS__ = ORIGIN (SRAM)
                0x0000000000100000                __RAM_SIZE__ = 0x100000
OUTPUT(S32V234_Flash_A53_1.elf elf64-littleaarch64)

Outcomes