afull’s reputation

afull's reputation

Total 42
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
+1
July 21, 2016 Commented Hi, I am still struggling with section mapping in the linker. My linker script looks like this: /*********************************************************************************** * File: HardwareDebug.ld * Author: Adam Fullerton * Date: 19/04/2016 * * $Workfile: $ * $Revision: $ * $Project: $ Swarm Systems Hawk * $Compiler: $ GNUARM-NONEV16.01-EABI * $Target: $ RZ/A1H * $State: $ Stab * ('Exp'erimental/'Stab'le/'Rel'eased) * $Date $ * * Description : Linker script file for RZA1/H RSK HardwareDebug build * * (C) Swarm Systems Ltd. 2016 All rights reserved. * * A: 1 The Mount, Old Blandford Road, Salisbury, Wiltshire. SP2 8BZ * T: 01722 341 027 * E: adam@ardware.co.uk * W: www.ardware.co.uk * **********************************************************************************/ /********************************************************************************** Set the output format ***********************************************************************************/ OUTPUT_FORMAT("elf32-littlearm", "elf32-bigarm", "elf32-littlearm") OUTPUT_ARCH(arm) ENTRY(start) /********************************************************************************** Define the memory available on the RSK ***********************************************************************************/ MEMORY { /* On-Chip Data retention RAM >>> DISABLED AT RESET <<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> ROM IMAGE <<<<<<<<<<<<<<<<<<<<<<<<<<<<<< SRAM /****************************************************************************** System initialisation ******************************************************************************/ .system_init : { /* We need the code that initialises the system up until the point that the section initialisation has taken place to reside in one section which is not mapped to another place. This section has all the code & data to do this */ *reset_handler.o (.text) . = ALIGN(0x04); *peripheral_init_basic.o (.text) . = ALIGN(0x04); *rza_io_regrw.o (.text) . = ALIGN(0x04); /* Put the code from the initsect function here */ *initsect.o (.text) . = ALIGN(0x04); /* Also put the initialised data section here */ *initsect.o (.init_data) . = ALIGN(0x04); } > SRAM /****************************************************************************** Executable code & read only data ******************************************************************************/ .code : { gExecutableCodeRomStart = .; gExecutableCodeRamStart = .; PROVIDE_HIDDEN (__exidx_start = .); *(.init) PROVIDE_HIDDEN (__exidx_end = .); *(.text) *(.fini) *(.jcr) __CTOR_LIST__ = .; . = ALIGN(2); __ctors = .; *(.ctors) __ctors_end = .; __CTOR_END__ = .; __DTOR_LIST__ = .; ___dtors = .; *(.dtors) ___dtors_end = .; __DTOR_END__ = .; . = ALIGN(2); _mdata = .; _srodata = .; *(.rodata)*(.rodata.*) . = ALIGN(0x04); _erodata = .; gExecutableCodeRomEnd = .; } > SRAM /* >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> RAM IMAGE <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<SRAM /* TODO: Move */ .bss : { gUnintialisedDataRamStart = .; *(.bss) *(.bss.**) *(COMMON) gUnintialisedDataRamEnd = .; } > SRAM /****************************************************************************** Heaps ******************************************************************************/ .sram_heap_start (NOLOAD) : { /* The L1 cache line size is 32 bytes. To avoid cache synchronisation problems the malloc functions will align allocations to 32 byte boundaries. However in order for the scheme to work the area assigned to the heap must be aligned to a 32byte boundary as well */ gSRamHeapStart = ALIGN(0x20); } > SRAM .sram_heap_end (NOLOAD) : { gSRamHeapEnd = .; } > SRAM_END .sdram_heap_start (NOLOAD) : { /* The L2 cache line size is 32 bytes. To avoid cache synchronisation problems the malloc functions will align allocations to 32 byte boundaries. However in order for the scheme to work the area assigned to the heap must be aligned to a 32byte boundary as well */ gSDRamHeapStart = .; } > SDRAM .sdram_heap_end (NOLOAD) : { gSDRamHeapEnd = ALIGN(0x20); } > SDRAM_END /****************************************************************************** Stacks & TLB ******************************************************************************/ /* The application does not require the data retention function. The area is not usable until the processor is running the application code as it is disabled on reset. Assign the stacks & TLB to this memory which would otherwise be unused. Ensure System control register 3 SYSCR3 is initialised before stack pointers are loaded */ .irq_stack (NOLOAD): { irq_stack_start = .; . += 8k; . = ALIGN(0x08); irq_stack_end = .; } >RRAM .fiq_stack (NOLOAD): { fiq_stack_start = .; . += 4k; . = ALIGN(0x08); fiq_stack_end = .; } >RRAM .svc_stack (NOLOAD): { PROVIDE(svc_stack_start = .); . += 8k; . = ALIGN(0x08); svc_stack_end = .; } >RRAM .abt_stack (NOLOAD): { abt_stack_start = .; . += 4k; . = ALIGN(0x08); abt_stack_end = .; } >RRAM .program_stack (NOLOAD): { program_stack_start = .; . += 8k; . = ALIGN(0x08); program_stack_end = .; } >RRAM .ttb_mmu1 : { ttb_mmu1_base = .; . += 32k; . = ALIGN(0x04); ttb_mmu1_end = .; } >RRAM } /********************************************************************************** EOF ***********************************************************************************/ The section initialisation code looks like this: /*********************************************************************************** * File: initsect.c * Author: Adam Fullerton * Date: 20/07/2016 * * $Workfile: $ * $Revision: $ * $Project: $ Swarm Systems Hawk * $Compiler: $ GNUARM-NONEV16.01-EABI * $Target: $ RZ/A1H * $State: $ Stab * ('Exp'erimental/'Stab'le/'Rel'eased) * $Date $ * * Description : Section initialisation function * * (C) Swarm Systems Ltd. 2016 All rights reserved. * * A: 1 The Mount, Old Blandford Road, Salisbury, Wiltshire. SP2 8BZ * T: 01722 341 027 * E: adam@ardware.co.uk * W: www.ardware.co.uk * **********************************************************************************/ /*********************************************************************************** External symbols defined in the linker script ***********************************************************************************/ extern char gInitialisedDataRomStart; extern char gInitialisedDataRomEnd; extern char gInitialisedDataRamStart; extern char gExecutableCodeRomStart; extern char gExecutableCodeRomEnd; extern char gExecutableCodeRamStart; extern char gUnintialisedDataRamStart; extern char gUnintialisedDataRamEnd; /*********************************************************************************** Constant data ***********************************************************************************/ /* ROM to RAM mapped section table for C/C++ run time library initialisation */ static const struct _DSEC { /* Start address of the initialised data section in ROM */ void *pvRomStart; /* End address of the initialised data section in ROM */ void *pvRomEnd; /* Start address of the initialised data section in RAM */ void *pvRamStart; } gpCopyTable[] __attribute__((section(".init_data"))) = { /* The initialised data section copied to RAM */ { &gInitialisedDataRomStart, &gInitialisedDataRomEnd, &gInitialisedDataRamStart }, /* The code section copied to RAM */ { &gExecutableCodeRomStart, &gExecutableCodeRomEnd, &gExecutableCodeRamStart }, /* TODO: Add all initialised sections here */ }; /* The non-initialised data section table for C run time library initialisation */ static const struct _BSEC { /* Start address of non-initialised data section */ void *pvRamStart; /* End address of non-initialised data section */ void *pvRamEnd; } gpZeroTable[] __attribute__((section(".init_data"))) = { { &gUnintialisedDataRamStart, &gUnintialisedDataRamEnd }, /* TODO: Add all other sections here */ }; /*********************************************************************************** Public Functions ***********************************************************************************/ /*********************************************************************************** * Function Name: initsect * Description : Function to perform section initialisation * Arguments : none * Return Value : none ***********************************************************************************/ void initsect(void) { register unsigned int uiCount; { register struct _DSEC *pCopyTable = (struct _DSEC*)gpCopyTable; /* Calculate the number of entries in the mapped Data Table */ uiCount = sizeof(gpCopyTable) / sizeof(struct _DSEC); while (uiCount--) { /* Allow a RAM based build (HardwareDebug) to link the initialised data so that no copying is required - with the caveat that the code will only be run once before being down loaded to RAM again. Therefore check that the ROM and RAM are not the same before performing the copy */ if (pCopyTable->pvRomStart != pCopyTable->pvRamStart) { register char *pbyDestination = (char*)pCopyTable->pvRamStart; register char *pbySource = (char*)pCopyTable->pvRomStart; register unsigned int uiLength = (unsigned int)(pCopyTable->pvRomEnd - pCopyTable->pvRomStart); /* Copy the section */ while (uiLength--) { *pbyDestination++ = *pbySource++; } } pCopyTable++; } } { register struct _BSEC *pZeroTable = (struct _BSEC*)gpZeroTable; /* Calculate the number of entries in the Non-initialised Data Table */ uiCount = sizeof(gpZeroTable) / sizeof(struct _BSEC); while (uiCount--) { register char *pbyDestination = pZeroTable->pvRamStart; register unsigned int uiLength = (unsigned int)(pZeroTable->pvRamEnd - pZeroTable->pvRamStart); /* Initialise the section to 0 */ while (uiLength--) { *pbyDestination++ = (char)0; } pZeroTable++; } } } /*********************************************************************************** End of function initsect ***********************************************************************************/ /*********************************************************************************** End Of File ***********************************************************************************/ However I cannot figure out the syntax to map the sections .code and .data into the memory area SDRAM. I have tried things like: .code : AT(ADDR(.mapped_code)) { gExecutableCodeRomStart = .; gExecutableCodeRamStart = .; PROVIDE_HIDDEN (__exidx_start = .); *(.init) PROVIDE_HIDDEN (__exidx_end = .); *(.text) *(.fini) *(.jcr) __CTOR_LIST__ = .; . = ALIGN(2); __ctors = .; *(.ctors) __ctors_end = .; __CTOR_END__ = .; __DTOR_LIST__ = .; ___dtors = .; *(.dtors) ___dtors_end = .; __DTOR_END__ = .; . = ALIGN(2); _mdata = .; _srodata = .; *(.rodata)*(.rodata.*) . = ALIGN(0x04); _erodata = .; gExecutableCodeRomEnd = .; } > SRAM .mapped_code (NOLOAD) : { gExecutableCodeRamStart .= ALIGN(0x04); SIZEOF(.code) } > SDRAM but ld just barfs on the syntax. Can you show me how to modify the script to achieve this? Cheers, Adam.
+1
June 29, 2016 Commented Hi, In an attempt to get the RZA1 debugging dialog back I uninstalled e2 Studio and ran setup_e2_studio_5_0_1_005. On start-up it registered the RZ tool chain and project generators. I imported the workspace and launched the debugger to get the following error: Exception occured during launch. Reason: Error in final launch sequence. Details: Error in final launch sequence Failed to execute MI command: target extended-remote localhost:61234 Error message from debugger back end: localhost:61234: The system tried to join a drive to a directory on a joined drive. Failed to execute MI command: target extended-remote localhost:61234 Error message from debugger back end: localhost:61234: The system tried to join a drive to a directory on a joined drive. localhost:61234: The system tried to join a drive to a directory on a joined drive. So then I thought I'd see if I generated a project (using the new bug fixed generators) to see if I could make a debug connection. On the Select Additional CPU Options there is still no Target FPU option of vfpv3, just none & vfp. I changed the Floating Point ABI to Hard, selected Newlib with all header files and project built library. I built the project and launched the debug connection to get exactly the same error. On the generated project the debug configuration debugger tab has the J-Link ARM R7S72100 device, but the imported project still has the white cross on the red background. This is very frustrating as all I want to do is to continue working. Any suggestions apart from rolling back to 4.3.0.007 which I started working on the project with?# Best regards, Adam.
Support