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


Modifying the Makefile

Posted by Monish Sunku Prabhakar on June 16, 2009
Hi all,
I wanted to modify makefile so that I have the freertos.out file along with the freertos.bin

Modifying the Makefile

Posted by Monish Sunku Prabhakar on June 16, 2009
Some guidelines on how to obtain the freertos.out file would be really helpful. I need the .out file for debugging purposes for AT91SAM7256 processor. Currently I am using eclipse.

Thanks in advance,

RE: Modifying the Makefile

Posted by MEdwards on June 16, 2009
You need to use the objcopy command that comes with GCC. Take a look at the binutils manual which you will find somewhere on the gnu.org site. Or simply type "arm-none-eabi-objcopy /?" or "arm-elf-gcc /?" depending on the version of gcc being used.

RE: Modifying the Makefile

Posted by Monish Sunku Prabhakar on June 17, 2009
Thanks Edwards. I referred the binutils manual in GNU.org but I am still skeptical of the usage considering that I am not an expert. So here is the Makefile.


# CFLAGS common to both the THUMB and ARM mode builds

-I. \
-I./drivers \
-I./tasks \
-I./armlib \
-I./armlib/arch/at91 \
-I./fatfs \
-I../Common/include \
-I../../Source/include \
-I../../Source/portable/GCC/ARM7_AT91SAM7S \
-Wall \
-mthumb-interwork \
-mcpu=arm7tdmi \
$(DEBUG) \
$(OPTIM) \
#-Wextra \
#-Wstrict-prototypes \
#-Wmissing-prototypes \
#-Wmissing-declarations \
#-Wno-strict-aliasing \

#-I./wifi \
#-I./wifi/wlan \
#-I./wifi/tcpuip \
#-I./wifi/tcpuip/dhcp \
#-I./wifi/tcpuip/resolv \
#-I./wifi/wlan \
#-I./wifi/wlan/WhizFi \

LINKER_FLAGS=-Xlinker -ofreertos.elf -Xlinker -M -Xlinker -Map=freertos.map

# Source files that can be built to THUMB mode.
../../Source/tasks.c \
../../Source/queue.c \
../../Source/list.c \

../../Source/portable/MemMang/heap_2.c \
main.c \
drivers/ad8400.c \
drivers/ads8341e.c \
drivers/wave.c \
drivers/common.c \
drivers/sd-mmc.c \
drivers/spigate.c \
tasks/airTasks.c \
tasks/recordTasks.c \
armlib/rprintf.c \
armlib/arch/at91/processor.c \
armlib/arch/at91/uart.c \
fatfs/ff.c \
#drivers/spi.c \
#armlib/arch/at91/spi.c \
#wifi/common.c \
#wifi/debug.c \
#wifi/flash_opp.c \
#wifi/wln_config.c \
#wifi/tcpuip/nic.c \
#wifi/tcpuip/tcp_config.c \
#wifi/tcpuip/uip_arp.c \
#wifi/tcpuip/uip_split.c \

# Source files that must be built to ARM mode.
# Generally, ISRs and the like -MikeG
tasks/pioIsr.c \
../../Source/portable/GCC/ARM7_AT91SAM7S/portISR.c \

# Define all object files.
ARM_OBJ = $(ARM_SRC:.c=.o)

all: freertos.bin freertos.hex

freertos.bin : freertos.elf
$(OBJCOPY) freertos.elf -O binary freertos.bin

freertos.hex : freertos.elf
$(OBJCOPY) freertos.elf -O ihex freertos.hex

freertos.elf : $(ARM_OBJ) $(DEMO_APP_THMUB_OBJ) $(FREERTOS_THUMB_OBJ) $(CRT0) Makefile FreeRTOSConfig.h

$(DEMO_APP_THMUB_OBJ) : %.o : %.c $(LDSCRIPT) Makefile FreeRTOSConfig.h
$(CC) -c $(THUMB_FLAGS) $(CFLAGS) $< -o $@

$(FREERTOS_THUMB_OBJ) : %.o : %.c $(LDSCRIPT) Makefile FreeRTOSConfig.h
$(CC) -c $(THUMB_FLAGS) $(CFLAGS) $< -o $@

$(ARM_OBJ) : %.o : %.c $(LDSCRIPT) Makefile FreeRTOSConfig.h
$(CC) -c $(CFLAGS) $< -o $@

#clean :
#touch Makefile

# make target called by Eclipse (Project -> Clean ...)
-rm $(ARM_OBJ) $(FREERTOS_THUMB_OBJ) $(DEMO_APP_THMUB_OBJ) freertos.elf freertos.bin freertos.map freertos.hex

# **********************************************************************************************
# Alternate make target for flash programming only
# You must create a special Eclipse make target (program) to run this part of the makefile
# (Project -> Create Make Target... then set the Target Name and Make Target to "program")
# OpenOCD is run in "batch" mode with a special configuration file and a script file containing
# the flash commands. When flash programming completes, OpenOCD terminates.
# Note that the script file of flash commands (script.ocd) is part of the project
# Programmers: Martin Thomas, Joseph M Dupre, James P Lynch
# Modifies:Gabriele Brosulo, 22/08/2007
# **********************************************************************************************

# specify output filename here (must be *.bin file)
TARGET = freertos.bin

# specify the directory where openocd executable and configuration files reside
OPENOCD_DIR = '/usr/local/OpenOCD/src/'

# specify OpenOCD executable (pp is for the wiggler, ftd2xx is for the USB debuggers)

# specify OpenOCD configuration file (pick the one for your device)
OPENOCD_CFG = OpenOCD/at91sam7s256-wiggler-flash-program.cfg

# program the AT91SAM7S256 internal flash memory
program: $(TARGET)
@echo "Flash Programming with OpenOCD..."# display a message on the console
sudo $(OPENOCD) -f $(OPENOCD_CFG)# program the onchip FLASH here
@echo "Flash Programming Finished."# display a message on the console

So is
-freertos.out : freertos.out
-$(OBJCOPY) freertos.elf -O srec freertos.out

The right way to get a .out file in our Makefile?


[ 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