Main Site Documentation

Keil 32KB limitation


#1

Hi,

i have a project that bigger then 32KB and i am looking for solution since keil has limitation (in the free version)
i saw that compiler is fine and the problem is the linker.
what can i do? do you know about others tools to build my bin file?

I am using Hydra with RLP light…


#2

You can use GCC compiler


#3

In keil i configure the linker to use R/O base to 0xA000000 and R/W base to 0xA0080000
and also configure it to create bin file and axf. something like that (under user tab,in run after build): fromelf --bin --output=Sensor.bin SensorSimHydra.axf

how can i do all this in GCC?

can you please give me example what is the correct command to creat bin file for hydra in case i have files like a.c, b.c , a.h, b.h? and i want to bin to called myBin.bin?


#4

@ shm3 - You do not need to set these addresses, you can convert the output to raw binary file which is then loaded by the managed code to the correct address for RLPLite on the Hydra.

Here is a snippet from the batch file that I use
Note: RLPProxyGen is a little tool that I wrote which generates the managed stubs from the map file, it resolves all the function addresses etc. (You can find an early version on code share, if it does not work let me know and I will put up the latest code).


@ echo off

echo Building
if exist Output goto startbuild
md Output
:startbuild
make

if not errorlevel 0 goto error

echo Copying
\Embedded\ARMEmbedded\4.6.2012q2\arm-none-eabi\bin\objcopy.exe -O binary Output\RLPForth.elf Output\RLPForth.bin
copy Output\RLPForth.bin ..\dotnetwarrior.NetMF.Native.Forth\Resources> /y
RLPProxyGen Output\RLPForth.map ..\dotnetwarrior.NetMF.Native.Forth\RLPMethods.cs RLPMethods
goto done

:error
echo Build with errors

:done
echo Done.

The key thing here is the objcopy.exe command which converts the elf file to raw binary which can be loaded onto the Hydra.

Here is the makefile I use, this is for one of my RLPLite projects on the Hydra. The commented sections play with the optimizations and generation of assembly listing which is sometimes helpful when troubleshooting.


OUTFILE=RLPForth
LINKERSCRIPT = RLP_LinkScript.lds

INCL=./include

CC		=arm-none-eabi-gcc
LD		=arm-none-eabi-gcc

CCFLAGS=  -mlittle-endian -mcpu=arm7tdmi -Wall -I. -I$(INCL)
 #CCFLAGS+= -mapcs-frame -fno-builtin -g0
CCFLAGS+= -fno-builtin
CCFLAGS+= -Os -std=c99
CCFLAGS+= -save-temps
 #CCFLAGS+= -fverbose-asm -c -g

LDFLAGS =-nostartfiles -Wl,--Map -Wl,./Output/$(OUTFILE).map
LDFLAGS+=-lc -lgcc -Wl,--omagic
LDFLAGS+=-T $(LINKERSCRIPT)

OBJS+= rlpforth.o
OBJS+= common.o
OBJS+= dictionary.o
OBJS+= interp.o
OBJS+= interperrors.o
OBJS+= tokenizer.o

rebuild: clean all del_o

all: $(OBJS)
	$(LD) $(LDFLAGS) -o ./Output/$(OUTFILE).elf $(OBJS) -lm

rlpforth.o: rlpforth.c
	$(CC) -c $(CCFLAGS) rlpforth.c -o rlpforth.o
  
common.o: common.c 
	$(CC) -c $(CCFLAGS) common.c -o common.o
  
dictionary.o: dictionary.c 
	$(CC) -c $(CCFLAGS) dictionary.c -o dictionary.o
  
interp.o: interp.c 
	$(CC) -c $(CCFLAGS) interp.c -o interp.o
  
interperrors.o: interperrors.c 
	$(CC) -c $(CCFLAGS) interperrors.c -o interperrors.o
  
tokenizer.o: tokenizer.c 
	$(CC) -c $(CCFLAGS) tokenizer.c -o tokenizer.o

clean:
	-rm *.o ./Output/*.elf ./Output/*.bin ./Output/*.map

del_o:
	-rm *.o

del_map:
	-rm ./Output/*.map


#5

Thanks!!

I downloaded “GNU tools ARM embedded” and tried to run this makefile.
i succeeded to run regular compilation commands but not make.

do you know how to run makeFile? when i try to run it with gcc i get unrecognize file


#6

@ shm3 - What make tool are you running? I am using make that was installed with the yagarto tool chain but I am using the ARM tool chain. If you grab GNU Make for windows it should work, I have not tried it myself though.


#7

Just some creative thinking… maybe its possible to use KEIL just for compilation if it produces better code than a GNU compiler, and use the GNU linker to link everything together.


#8

@ taylorza - i am using this tool:
GNU Tools for ARM Embedded Processors Version: 4.7

i have file called makefile that looks like:


OUTFILE=RLPForth
LINKERSCRIPT = RLP_LinkScript.lds
 
INCL=./include
 
CC		=arm-none-eabi-gcc
LD		=arm-none-eabi-gcc
 
CCFLAGS=  -mlittle-endian -mcpu=arm7tdmi -Wall -I. -I$(INCL)
 #CCFLAGS+= -mapcs-frame -fno-builtin -g0
CCFLAGS+= -fno-builtin
CCFLAGS+= -Os -std=c99
CCFLAGS+= -save-temps
 #CCFLAGS+= -fverbose-asm -c -g
 
LDFLAGS =-nostartfiles -Wl,--Map -Wl,./Output/$(OUTFILE).map
LDFLAGS+=-lc -lgcc -Wl,--omagic
LDFLAGS+=-T $(LINKERSCRIPT)
 
OBJS+= RLPLite.o
OBJS+= GeneralSensor.o
 
rebuild: clean all del_o
 
all: $(OBJS)
	$(LD) $(LDFLAGS) -o ./Output/$(OUTFILE).elf $(OBJS) -lm
 
RLPLite.o: RLPLite.c
	$(CC) -c $(CCFLAGS) RLPLite.c -o RLPLite.o
 
GeneralSensor.o: GeneralSensor.c 
	$(CC) -c $(CCFLAGS) GeneralSensor.c -o GeneralSensor.o
 

clean:
	-rm *.o ./Output/*.elf ./Output/*.bin ./Output/*.map

i tried to run make with gcc and got this:

[quote]C:\Program Files (x86)\GNU Tools ARM Embedded\4.7 2013q2\bin>arm-none-eabi-gcc.exe make
arm-none-eabi-gcc.exe: error: make: No such file or directory
arm-none-eabi-gcc.exe: fatal error: no input files
compilation terminated.

C:\Program Files (x86)\GNU Tools ARM Embedded\4.7 2013q2\bin>make
’make’ is not recognized as an internal or external command,
operable program or batch file.

C:\Program Files (x86)\GNU Tools ARM Embedded\4.7 2013q2\bin>makefile
’makefile’ is not recognized as an internal or external command,
operable program or batch file.

C:\Program Files (x86)\GNU Tools ARM Embedded\4.7 2013q2\bin>arm-none-eabi gcc.exe makefile
c:/program files (x86)/gnu tools arm embedded/4.7 2013q2/bin/…/lib/gcc/arm-none
-eabi/4.7.4/…/…/…/…/arm-none-eabi/bin/ld.exe:makefile: file format not recog
nized; treating as linker script
c:/program files (x86)/gnu tools arm embedded/4.7 2013q2/bin/…/lib/gcc/arm-none
-eabi/4.7.4/…/…/…/…/arm-none-eabi/bin/ld.exe:makefile:2: syntax error
collect2.exe: error: ld returned 1 exit status[/quote]



#9

@ shm3 - you do not seem to have make installed or it is not in the path. Make is a build tool that will process the makefile and build your code. So you first need to get make on your machine.

Install the yagarto tools from the link below to get make. Note, do not install in a path with spaces.

http://www.emb4fun.de/download/arm/yagarto/yagarto-tools-20121018-setup.exe


#10

Thanks - now it works.

what is LINKERSCRIPT = RLP_LinkScript.lds?

from can i get this file?

and also i get error warning:
" warning: cannot find entry symbol _start; defaulting to 00008000"

is it o.k.?


#11

@ shm3 - Here is the link script file I use for the Hydra, if I recall correctly I modified this from the RLP sample provided for the Spider.


/*************************************/
/* Copyright(c) GHI Electronics, LLC */
/*************************************/

OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm")
OUTPUT_ARCH(arm)

MEMORY
{
  SDRAM (wx) : ORIGIN = 0xA0000000, LENGTH = 0x00100000
}

SECTIONS
{
        . = ALIGN(4);
        .text : 
        { 
        	*(.text)
        }

        . = ALIGN(4);
        .rodata : 
        { 
          *(.rodata )
        }
        
        . = ALIGN(4);
        .data : 
        { 
        	*(.data)
        }

         . = ALIGN(4);
        .bss : 
        {
            __bss_start__ = .;
            *(.bss)
            __bss_end__ = .;
        }

   
}
end = .;  /* define a global symbol marking the end of application RAM */




#12

what should i do with this file?
Just save it as lds file?

i succeeded to build my project without this file, converted it to bin, called it from C# but i saw it didnt come in to RLP.
(the address was correct).

i guess it also because my symbol starts at 0x0000800 (with keil i configured it to R/O base to 0xA000000 and R/W base to 0xA0080000)


#13

@ shm3 - Yes, save it as RLP_LinkScript.lds in the same folder as your project.

You can also specify more specific memory addresses like you did in Keil, but in all likelihood you do not need to do that for your project.


#14

Thanks! Works!


#15

@ shm3 - It is a pleasure, glad it is working… now the fun begins :slight_smile: