Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Real time embedded FreeRTOS mailing list 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem TCP & FAT Training




Loading

for what purpose is start.asm ?

Posted by Nobody/Anonymous on June 24, 2005
Hi,

there is a file in the demo-directory called "start.asm": it seems
it is intended as start-hook from which hw_initialise is called e.g.
But it is not referenced at all nowhere !

So how is hw_initialise in the demo-main.c called actually ?
What do I have to modify to call hw_initialise ? When I try to link start.asm, the compiler complains:

"
./Demo/H8S/RTOSDemo/start.o(.text+0x0): In function `_start':
: multiple definition of `_start'
/usr/share/gnuh8300_v0501_elf-1/lib/gcc/h8300-elf/3.4-GNUH8_v0501/../../../../h8300-elf/lib/h8300s/crt0.o(.text+0x0): first defined here
"

Any help highly appreciated, cause I am stuck at this point.

Cheers,
Marc

RE: for what purpose is start.asm ?

Posted by Richard on June 24, 2005
This is not really a FreeRTOS related question - but a GNU linker question (for which KPIT provide excellent free support)... however.

If you go to "options->linker" from the HEW menu, then select the "other" tab you will see that there is a user defined option "-e _start".

As per the GNU linker manual (http://www.gnu.org/software/binutils/manual/ld-2.9.1/html_mono/ld.html) the -e option defines an explicit entry point into the code.

If you take a look in start.asm, you will see the label _start immediately before the call to _hw_initialise (after the stack is setup). The effect of the -e option is then that the first thing the program does when it start is call the function you are after.

The easiest way to use FreeRTOS is to take the demo application project (which should compile as downloaded [hopefully]) and then add into this the files you want to compile, and remove the files you don't want. This way all the project options and startup code are preconfigured.

Regards.


RE: for what purpose is start.asm ?

Posted by Nobody/Anonymous on June 24, 2005
Thanks for these hints,

I am developping under Linux and cannot apply your hints 1:1. Anyway I tried some things in the meantime without any success:

I have loaded the HEW-file into HEW on a windows-PC and had a look into the options; i found the -e _start - option and all the other options. Simply adding the option -e _start did not help.

As soon as I add the start.o to the list of OSE-objects within my (handwritten) Makefile, the Linker complains.

the important parts of the Makefile :

CC = h8300-elf-gcc
LD = h8300-elf-ld
....
INCLUDE = -I./ose/FreeRTOS/Source/include \
-I./ose/FreeRTOS/Demo/Common/include \
-I./ose/FreeRTOS/Demo/H8S/RTOSDemo/

OSEFLAG = -DGCC_H8S $(INCLUDE)

LIBOPT = -L "/usr/share/gnuh8300_v0501_elf-1/lib/gcc/h8300-elf/3.4-GNUH8_v0501/h8300s/" -L "/usr/share/gnuh8300_v0501_elf-1/h8300-elf/lib/h8300s/"

CFLAGS= -ms -I ./gui/Config -I ./gui/Core/ $(OSEFLAG)
...
all: $(GUIOBJS) $(LCDOBJS) $(OSEDEMOOBJS) $(OSEOBJS) guilib lcdlib ose demo ./ose/FreeRTOS/main.lnk
$(CC) $(CFLAGS) $(LIBOPT) -lm -lc -lgcc -e _start -T ./ose/FreeRTOS/main.lnk -o sip.elf $(GUIOBJS) $(LCDOBJS) $(OSEDEMOOBJS) $(OSEOBJS)
h8300-elf-objcopy ./sip.elf -O srec ./sip.mot

Please tell me if you think I am an idiot and did something very silly.

My basic problem is that I want to use the external RAM on the EDK2329. For this purpose, some registers must be set to another value than the default. But this has to be done in hw_initialise I guess. Just to see the background of this.
As long as I leave the linkerscript as it was (i.e. internal RAM at FF7C00) everything works fine, LED is flashing and so on.
The "start.o" is not included in the object-files in this case.

But to use the external RAM properly, the hw_initialise has to be called, so I added start.o to the list of objects and did a call to "h8300-elf-as" to assemble it, but then I get the errormessage that _start is defined twice.

Can you help me out of this ? I am getting crazy I think, cause it keeps me busy for two days now.

Thanks a lot in advance.

Marc


RE: for what purpose is start.asm ?

Posted by Richard on June 24, 2005
Sorry to state the obvious, but sometimes it is worth it - have you checked the symbol/map files to see where the other _start definition is?

Other than that - the HEW has an option to generate a makefile and linker script from the HEW project. I have just given it a try and it looks 'comprehensive'. Maybe if you started with that and could get that to work, you could then make the changes you require? Or at least compare it to your hand written version.

If you still have access to a Windoze machine then you will find the option "Generate makefile" on the "Build" menu item. Alternatively send me an email and I will send you the one I just generated. Email address on the contact page of the WEB site (r dot barry at free....).

RE: for what purpose is start.asm ?

Posted by Nobody/Anonymous on June 24, 2005
I know where the second definition is, because the linker tells
me; it is the startup-object crt0.o:

"
: multiple definition of `_start'
/usr/share/gnuh8300_v0501_elf-1/lib/gcc/h8300-elf/3.4-GNUH8_v0501/../../../../h8300-elf/lib/h8300s/crt0.o(.text+0x0): first defined here
"

Thanks for the hint with HEW, I generated the Makefile and it
is under investigation currently, but still did not find the problem.

Marc

RE: for what purpose is start.asm ?

Posted by Richard on June 24, 2005
If you cannot find how to prevent crt0 being included, then how about modifying start.asm to change the _start label to (for example) _mystart. Then use the -e option to force _mystart to be the entry point actually used with no conflict?

RE: for what purpose is start.asm ?

Posted by Nobody/Anonymous on June 24, 2005
Yes, this possibility works: it compiles and links fine, but the program does not start.

But that must be a different problem caused with the RAM-access-initialization, although everything should be setup fine.

Anyway - thanks a lot for your help, I will go to bed now I think, it is better to sleep over it a night, I think and try later again.

Cheers,
Marc


[ Back to the top ]    [ About FreeRTOS ]    [ Sitemap ]    [ ]




Copyright (C) 2004-2010 Richard Barry. Copyright (C) 2010-2016 Real Time Engineers Ltd.
Any and all data, files, source code, html content and documentation included in the FreeRTOSTM distribution or available on this site are the exclusive property of Real Time Engineers Ltd.. See the files license.txt (included in the distribution) and this copyright notice for more information. FreeRTOSTM and FreeRTOS.orgTM are trade marks of Real Time Engineers Ltd.

Latest News:

FreeRTOS V9.0.0 is now available for download.


Free TCP/IP and file system demos for the RTOS


Sponsored Links

⇓ Now With No Code Size Limit! ⇓
⇑ Free Download Without Registering ⇑


FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Renesas Electronics Gold Alliance RTOS Partner.jpg

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

Atmel RTOS partner supporting ARM Cortex-M3 and AVR32 microcontrollers

STMicro RTOS partner supporting ARM7, ARM Cortex-M3, ARM Cortex-M4 and ARM Cortex-M0

Xilinx Microblaze and Zynq partner

Silicon Labs low power RTOS partner

Altera RTOS partner for Nios II and Cortex-A9 SoC

Freescale Alliance RTOS Member supporting ARM and ColdFire microcontrollers

Infineon ARM Cortex-M microcontrollers

Texas Instruments MCU Developer Network RTOS partner for ARM and MSP430 microcontrollers

Cypress RTOS partner supporting ARM Cortex-M3

Fujitsu RTOS partner supporting ARM Cortex-M3 and FM3

Microsemi (previously Actel) RTOS partner supporting ARM Cortex-M3

Atollic Partner

IAR Partner

Keil ARM Partner

Embedded Artists