execute ppc code from external ram

Jun 09, 2005 1 Replies

We have made a memory controller which handles accesses from/to ddr sdram. A bootloader is running in bram and we download an application into external ram. The code in the external ram is exactly what we downloaded. If we jump to it, the powerpc starts executing from it and for some reason it comes in bram again (it's running the bootloader code). AFAIK there is no jump in the application and there was no reset.



If we use the debugger to download the application to external ram (with dow ) and run the code, everything is working fine. When I built the application, I use the following makefile:



======================= ################################################################# # Makefile #################################################################



CC = powerpc-eabi-gcc AR = powerpc-eabi-ar OBJCOPY = powerpc-eabi-objcopy OBJDUMP = powerpc-eabi-objdump


CFLAGS = -O2 -g



SRC = ./src INC = ./include



C_INC = ../include



OBJS = appl.o tl_debug.o uart.o



TOPDIR = ../ppc405_0/code SYSTEMDIR = ../../ppc_system/ppc405_0 INCLUDEDIR = $(SYSTEMDIR)/include LIBDIR = $(SYSTEMDIR)/lib INCLUDES = -I$(INCLUDEDIR) -I$(INC) -I$(C_INC) LIBS = -L$(LIBDIR) -L$(TOPDIR)



LIBRARIES =



# Linker options for the elf file LFLAGS = -Wl,-defsym -Wl,_START_ADDR=0x00000000



VPATH = $(SRC)



appl.o : appl.c tl_debug.o : tl_debug.c uart.o : uart.c



all: @echo "Makefile to build application which runs on DDR SDRAM" @echo " - RAM base address: 0x00000000" @echo " - application is placed in DDR SDRAM by bootloader" @echo "" @echo "Usage: make appl"



appl: $(INCLUDEDIR)/xparameters.h $(OBJS) makefile $(CC) $(CFLAGS) -o appl.elf $(OBJS) $(LFLAGS) $(LIBS) $(LIBRARIES) @echo "appl.elf created at location 0x00000000" @echo "" $(OBJDUMP) -D -b elf32-powerpc appl.elf > appl.txt $(OBJCOPY) -I elf32-powerpc -R .boot -R .boot0 -O binary -S appl.elf appl.bin



%.o:%.c $(CC) $(CFLAGS) -c $< -o $@ $(INCLUDES)



%.o:%.s $(CC) $(CFLAGS) -c $< -o $@



clean: rm -f $(OBJS) appl.elf appl.bin appl.txt



$(INCLUDEDIR)/xparameters.h: $(error Make sure you have built the libraries for the bootloader)



=======================



Do I have to use a linker file for locating different sections at the right place? What could be the reason for working in the debugger (gdb) and not working without debugger?



TIA, Frank


I can not totally explain the facts, but it's working now. There was something wrong with the startup procedure (the way I built the code was not correct). After using a linker file it worked.

Frank

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required