Yahoo Groups archive

Lpc2000

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

Message

Reset after code update

2006-05-08 by harisgmc

Hello all,

I'm working on a board based on LPC2138 and just added updating code 
through IAP. That seems to work fine but I wasn't able to reset the 
processor after the new code is in FLASH portion of the on chip 
memory. Tried using WD timer:

WDTC = 0x0FFF; 
WDMOD = 0x03; 
WDFEED = 0xAA;
WDFEED = 0x55;
while(1);

This works fine as long it is in the regular code (running from 
FLASH) but doesnt reboot the processor if placed in my function that 
is running of RAM area.

Also there is a assembly routine in startup.asm file to restart the 
code:

.global _reset, reset, exit, abort
.func   _reset

// -----------------------------------------------
// SOFT RESET
//
//	From within our c code, we can setup and interrupt
//	or some other bit twiddler that gets checked or 
//	simply make a call etc if we should want to perform
//	a soft reset.
//
//	A soft reset will jump back out here and we can 
//	cleanup and reset everthing.
//
//	The soft reset can be called via
//		reset, exit or abort
//
//	1 Disable interrupts
//	2 Force a hardware reset by driving P23 low
//
// -----------------------------------------------

_reset:
reset:
exit:
abort:

mov   r0,#0	// no arguments (argc = 0)
mov   r1,r0	// load R1 with a NULL
mov   r2,r0	// load R1 with a NULL
mov   fp,r0	// load frame pointer with a NULL
mov   r7,r0	// load frame pointer for thumb with a NULL
ldr   r10,=start // load R10 with the address of our startup above
mov   lr,pc
bx    r10	// jump to start

but when calling this function from my RAM based code I'm getting 
linker error:

Linking: NIC_W.elf
arm-elf-gcc -mthumb -mcpu=arm7tdmi-s -mthumb-interwork -I. -
DROM_RUN  -Os -Wall -Wcast-align -Wcast-qual -Wimplicit  -Wpointer-
arith -Wswitch -Wredundant-decls -Wreturn-type -Wshadow -Wunused -
Wa,-adhlns=Startup.lst  -I./inc -I./conf -MD -MP -
MF .dep/NIC_W.elf.d Startup.o   uartISR.o armVIC.o Timer0ISR.o 
AlliedFlash.o ramfunct.o NIC_W.o  uart.o sysTime.o Globals.o 
Initialize.o Utils.o LCD.o RTC.o PWM.o ADC.o NIC_Menus.o Main_ECHO.o 
Main_NIC.o Main_EVC.o Main_VPD.o FRAM.o NIC_Net.o NIC_Motor.o 
NIC_Crops.o     --output NIC_W.elf -nostartfiles -Wl,-Map=NIC_W.map,-
-cref -Wl,--section-start=.flashed_ram=0x40004500 -lc -lnewlib-lpc -
lm -lc -lgcc  -lstdc++ -TLPC2138-ROM.ld
ramfunct.o: In function `copy_code':ramfunct.c:(.fastrun+0x238): 
relocation truncated to fit: R_ARM_PC24 against symbol `reset' 
defined in .init section in Startup.o
make.exe: *** [NIC_W.elf] Error 1

Tried to put this assembly lines in the RAM routine - still doesn't 
reset the unit.

Anyone has any ideas about what I could be doing wrong?

Thanks for any help.

Haris Kahrimanovic

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.