Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem


for what purpose is start.asm ?

Posted by Nobody/Anonymous on June 24, 2005

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.


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.


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 \


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.


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.


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.


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

Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.

Latest News

Version 10.1.0 of the FreeRTOS kernel is available for immediate download. MIT licensed.

View a recording of the "OTA Update Security and Reliability" webinar, presented by TI and AWS.


FreeRTOS and other embedded software careers at AWS.

FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Espressif ESP32

IAR Partner

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers


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

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

OpenRTOS and SafeRTOS

Xilinx Microblaze and Zynq partner