From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7339 invoked by alias); 28 Jan 2011 16:19:04 -0000 Received: (qmail 7299 invoked by uid 22791); 28 Jan 2011 16:19:02 -0000 X-SWARE-Spam-Status: No, hits=-0.2 required=5.0 tests=AWL,BAYES_00,DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED,SPF_HELO_PASS,TW_XD,T_RP_MATCHES_RCVD,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: sourceware.org Received: from lo.gmane.org (HELO lo.gmane.org) (80.91.229.12) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 28 Jan 2011 16:18:55 +0000 Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1Pir2C-00065U-H6 for ecos-discuss@sources.redhat.com; Fri, 28 Jan 2011 17:18:52 +0100 Received: from dsl.comtrol.com ([64.122.56.22]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 28 Jan 2011 17:18:52 +0100 Received: from grant.b.edwards by dsl.comtrol.com with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 28 Jan 2011 17:18:52 +0100 To: ecos-discuss@sources.redhat.com From: Grant Edwards Date: Fri, 28 Jan 2011 16:25:00 -0000 Message-ID: References: <754762483.8033.1296230746071.JavaMail.root@idefix> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit User-Agent: slrn/pre0.9.9-102 (Linux) X-IsSubscribed: yes Mailing-List: contact ecos-discuss-help@ecos.sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: ecos-discuss-owner@ecos.sourceware.org Subject: [ECOS] Re: Different section placement for kernel and application X-SW-Source: 2011-01/txt/msg00094.txt.bz2 On 2011-01-28, Martin R??sch wrote: > Hi, > > Thanks for your answers. > >> In theory, you could apply section attributes to all of the kernel >> functions (or all of the application functions) so that you could >> separate them at link time into different output sections. > > That's what I was thinking of. I think this can be achieved with a > modified version of the cortexm.ld linker script, which is used to > generate the target.ld linker script. I'm curious why you want to do this. What benefit does it provide? > I studied the documentation of the GNU Linker Scripts and found some > hints to place the sections based from the input object file. I made > a try in the RAM Layout .ldi file: > > // eCos memory layout > > #include > #include > > MEMORY > { > sram : ORIGIN = 0x20000000, LENGTH = 0x00010000 > flash : ORIGIN = 0x08000000, LENGTH = 0x00080000 > rom : ORIGIN = 0x60000000, LENGTH = 0x00800000 > ram1 : ORIGIN = 0x64000000, LENGTH = 0x00800000-CYGNUM_HAL_COMMON_INTERRUPTS_STACK_SIZE > ram2 : ORIGIN = 0x68000000, LENGTH = 0x00800000 > } > > SECTIONS > { > SECTIONS_BEGIN > SECTION_rom_vectors (flash, 0x08010000, LMA_EQ_VMA) > SECTION_RELOCS (flash, ALIGN (0x8), LMA_EQ_VMA) > .ecos.text ALIGN (0x8) : LMA_EQ_VMA > { > vectors.o(.text*) vectors.o(.gnu.warning) vectors.o(.gnu.linkonce.t.*) vectors.o(.init) vectors.o(.glue_7) vectors.o(.glue_7t) > extras.o(.text*) extras.o(.gnu.warning) extras.o(.gnu.linkonce.t.*) extras.o(.init) extras.o(.glue_7) extras.o(.glue_7t) > libtarget.a(.text*) libtarget.a(.gnu.warning) libtarget.a(.gnu.linkonce.t.*) libtarget.a(.init) libtarget.a(.glue_7) libtarget.a(.glue_7t) > } > flash > .ecos.rodata ALIGN (0x8) : LMA_EQ_VMA > { > FORCE_OUTPUT; > vectors.o(.rodata*) vectors.o(.gnu.linkonce.r.*) > extras.o(.rodata*) extras.o(.gnu.linkonce.r.*) > libtarget.a(.rodata*) libtarget.a(.gnu.linkonce.r.*) > } > flash > SECTION_sram (sram, 0x20000400, LMA_EQ_VMA) > SECTION_text (ram1, 0x64008000, LMA_EQ_VMA) > SECTION_fini (ram1, ALIGN (0x8), LMA_EQ_VMA) > SECTION_rodata (ram1, ALIGN(0x8), LMA_EQ_VMA) > SECTION_rodata1 (ram1, ALIGN (0x8), LMA_EQ_VMA) > SECTION_fixup (ram1, ALIGN (0x8), LMA_EQ_VMA) > SECTION_gcc_except_table (ram1, ALIGN (0x8), LMA_EQ_VMA) > SECTION_eh_frame (ram1, ALIGN (0x8), LMA_EQ_VMA) > SECTION_got (ram1, ALIGN (0x8), LMA_EQ_VMA) > CYG_LABEL_DEFN(__heap1) = ALIGN (0x8); > SECTION_data (ram2, 0x68000000, LMA_EQ_VMA) > SECTION_bss (ram2, ALIGN (0x8), LMA_EQ_VMA) > SECTIONS_END > } > > hal_vsr_table = 0x20000000; > hal_virtual_vector_table = hal_vsr_table + 128*4; > hal_startup_stack = 0x64800000; > > With this modification the sections of the eCos components (from vectors.o, extras.o and libtarget.a) > are placed in the flash region when loaded with the RedBoot ROM monitor and GDB, > but a Bus error occurs in the reset_vector function: > > Loading section .rom_vectors, size 0x8 lma 0x8010000 > Loading section .ecos.text, size 0x10bcc lma 0x8010008 > Loading section .ecos.rodata, size 0x49dc lma 0x8020bd8 > Loading section .ARM.exidx, size 0x10 lma 0x64008000 > Loading section .text, size 0x924 lma 0x64008010 > Loading section .rodata, size 0x108 lma 0x64008938 > Loading section .data, size 0xdcc lma 0x68000000 > Start address 0x8010009, load size 93624 > Transfer rate: 9 KB/sec, 300 bytes/write. > > Program received signal SIGBUS, Bus error. > reset_vector () at [snip]/repo/ecos/packages/hal/cortexm/arch/current/src/vectors.S:100 > 100 ldr sp,=hal_startup_stack > > Is there a chance to get this working? I think so, yes. AFAIK, GDB stubs don't know how to program flash (and there's no indication it attempted to do so), so you're using some other mechanism to load the flash portion of the code? -- Grant Edwards grant.b.edwards Yow! Did I SELL OUT yet?? at gmail.com -- Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss