Yahoo Groups archive

Lpc2000

Index last updated: 2026-04-28 23:31 UTC

Message

Re: [lpc2000] Re: Olimex LPC2294H external flash

2006-05-25 by Karl Olsen

---- Original Message ----
From: "stefano_m_a" <stefano_mora@...>
To: <lpc2000@yahoogroups.com>
Sent: Thursday, May 25, 2006 2:47 PM
Subject: [lpc2000] Re: Olimex LPC2294H external flash

> is it possible to save some routines into the external flash (but
> boot into the internal one..) ?
> I try to modify my linker script adding an output section to point
> 0x8000.0000 area.
> I receive the following errors:
>
> Linking: main.elf
> arm-elf-gcc -mthumb -mcpu=arm7tdmi -mthumb-interwork -I. -gdwarf-2 -
> DROM_RUN  -O0 -Wall -Wcast-align -Wcast-qual -Wimplicit  -Wpointer-
> arith -Wswitch -Wredundant-decls -Wreturn-type -Wshadow -Wunused -Wa,-
> adhlns=crt0.lst   -MD -MP -MF .dep/main.elf.d crt0.o   lcd.o system.o
> buttons.o LPC_uart.o LPC_Vic.o adc.o armVIC.o ram.o main.o     --
> output main.elf -nostartfiles -Wl,-Map=main.map,--cref -lc  -lm -lc -
> lgcc -TLPC2214-ROM.ld
>
> ram.o: In function `RAM_read':
> /cygdrive/j/Progetti/Lpc/Progetti/FlashExt/ram.c:38: relocation
> truncated to fit: R_ARM_PC24 against symbol `LCDSendCommand' defined
> in .text section in lcd.o
> /cygdrive/j/Progetti/Lpc/Progetti/FlashExt/ram.c:47: relocation
> truncated to fit: R_ARM_PC24 against symbol `LCDSendChar' defined
> in .text section in lcd.o
> ram.o: In function `RAM_read_rev':
> /cygdrive/j/Progetti/Lpc/Progetti/FlashExt/ram.c:55: relocation
> truncated to fit: R_ARM_PC24 against symbol `LCDSendCommand' defined
> in .text section in lcd.o
> collect2: ld returned 1 exit status
> make: *** [main.elf] Error 1

Internal and external flash are further apart than can be spanned by a bl 
instruction, so you cannot call from internal to external flash or 
vice-versa with normal bl instructions.  Try:

/* file1.c */
int ext_flash_function (int i)  __attribute__((long_call));

int int_flash_function (void)
{
  ext_flash_function(1);
}

/* file2.c */
int ext_flash_function (int i)
{
  return i+i;
}


The long_call attribute tells gcc to use an indirect call when calling 
ext_flash_function().  This is larger and slower, but the callee can be 
anywhere in the address space.

Karl Olsen

Attachments

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.