From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27576 invoked by alias); 28 Jan 2011 16:05:59 -0000 Received: (qmail 27563 invoked by uid 22791); 28 Jan 2011 16:05:57 -0000 X-SWARE-Spam-Status: No, hits=-1.6 required=5.0 tests=AWL,BAYES_00,TW_XD X-Spam-Check-By: sourceware.org Received: from mail.neratec.ch (HELO mail.neratec.ch) (80.75.119.105) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 28 Jan 2011 16:05:49 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by mail.neratec.ch (Postfix) with ESMTP id EFB81664001 for ; Fri, 28 Jan 2011 17:05:46 +0100 (CET) Received: from mail.neratec.ch ([127.0.0.1]) by localhost (mail.neratec.ch [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 7CN20GQq8cHK for ; Fri, 28 Jan 2011 17:05:46 +0100 (CET) Received: from mail.neratec.ch (mail.neratec.ch [192.168.11.23]) by mail.neratec.ch (Postfix) with ESMTP id 2BAD2860D0 for ; Fri, 28 Jan 2011 17:05:46 +0100 (CET) Date: Fri, 28 Jan 2011 16:19:00 -0000 From: =?utf-8?Q?Martin_R=C3=B6sch?= To: "discuss, eCos" Message-ID: <754762483.8033.1296230746071.JavaMail.root@idefix> In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit 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: Re: [ECOS] Re: Different section placement for kernel and application X-SW-Source: 2011-01/txt/msg00093.txt.bz2 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 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? Greetings, Martin -- Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss