Big HEX files -> optimization !
2003-12-23 by capiman@t-online.de
Hello Robert,
i meanwhile have my environment with gcc 3.4 for the LPC2106 running.
I used your initialization file, but got very big HEX files (arund 23 KB for
a simple example "led.c").
When you leave out the line
bl exit /* Should not return */
then you get a HEX file of around 1,5 KB, because "exit" includes a lot of
library functions (like malloc, ...)
I don't think it is really needed, because the endless loop is already doing
it fine ?
Greetings,
Martin
----- Original Message -----
From: "Robert Adsett" <subscriptions@...>
To: <lpc2100@yahoogroups.com>
Sent: Tuesday, December 16, 2003 11:27 PM
Subject: Re: [lpc2100] Many thanks to ariusdsp -> how to build application ?
> At 05:13 PM 12/16/03 -0500, you wrote:
> >At 11:05 PM 12/16/03 +0100, you wrote:
> > >Has someone in the group already created such a linker script for the
> > >LPC2106 ?
> > >I started to modify the example, but it seems to be a non trivial task,
> > >without knowing the right syntax of a linker script.
> > >
> > >I think, what i am searching for is a "hello world" for LPC2106 with
gnu arm
> > >toolchain from source to hex-file...
> > >Leon: This is perhaps worth uploading to your website ?
> > >
> > >Greetings,
> >One linker script coming up.
>
> Oh and the startup that goes with it.
>
> /* Sample initialization file */
>
> .extern main
> .extern exit
>
> /* .text is used instead of .section .text so it works with
> arm-aout too. */
>
> .text
> .code 32
>
>
> .align 0
>
> .extern __bss_beg__
> .extern __bss_end__
> .extern __stack_end__
> .extern __data_beg__
> .extern __data_end__
> .extern __data+beg_src__
>
> .global start
> /* .global _mainCRTStartup */
> /* .global _start */
> .global endless_loop
>
> start:
> _start:
> _mainCRTStartup:
> /* Start by setting up a stack */
> /* Set up the stack pointer to end of bss */
> ldr r3, .LC6
> mov sp, r3
>
> sub sl, sp, #512 /* Still assumes 512 bytes below
sl */
>
> mov a2, #0 /* Second arg: fill value */
> mov fp, a2 /* Null frame pointer */
> mov r7, a2 /* Null frame pointer for Thumb
*/
>
> /* ldr r1, #__bss_beg__*/ /* First arg: start of
> memory block */
>
> ldr r1, .LC1 /* First arg: start of
> memory block */
> /* ldr r3, #__bss_end__*/ /* Second arg: end of memory block
*/
> ldr r3, .LC2 /* Second arg: end of
> memory block */
> subs r3, r3, r1 /* Third arg: length of
> block */
> beq .end_clear_loop
> mov r2, #0
>
> .clear_loop:
> strb r2, [r1], #1
> subs r3, r3, #1
> bgt .clear_loop
>
> .end_clear_loop:
>
> ldr r1, .LC3 /* First arg: start of
> memory block */
> ldr r2, .LC4 /* Second arg: end of memory
block */Show quoted textHide quoted text
> ldr r3, .LC5 > subs r3, r3, r1 /* Third arg: length of block */ > beq .end_set_loop > > .set_loop: > ldrb r4, [r2], #1 > strb r4, [r1], #1 > subs r3, r3, #1 > bgt .set_loop > > .end_set_loop: > > > mov r0, #0 /* no arguments */ > mov r1, #0 /* no argv either */ > > bl main > > endless_loop: > b endless_loop > > bl exit /* Should not return */ > > /* For Thumb, constants must be after the code since only > positive offsets are supported for PC relative addresses. */ > > .align 0 > .LC1: > .word __bss_beg__ > .LC2: > .word __bss_end__ > .LC3: > .word __data_beg__ > .LC4: > .word __data_beg_src__ > .LC5: > .word __data_end__ > .LC6: > .word __stack_end__ > > .section .startup,"ax" > .code 32 > .align 0 > > b start > b undefined_instruction_exception > b software_interrupt_exception > b prefetch_abort_exception > b data_abort_exception > b reserved_exception > b interrupt_exception > b fast_interrupt_exception > > Robert > > > " 'Freedom' has no meaning of itself. There are always restrictions, > be they legal, genetic, or physical. If you don't believe me, try to > chew a radio signal. " > > Kelvin Throop, III > > > To unsubscribe from this group, send an email to: > lpc2100-unsubscribe@yahoogroups.com > > > > > Yahoo! Groups Links > > To visit your group on the web, go to: > http://groups.yahoo.com/group/lpc2100/ > > To unsubscribe from this group, send an email to: > lpc2100-unsubscribe@yahoogroups.com > > Your use of Yahoo! Groups is subject to: > http://docs.yahoo.com/info/terms/ > >