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

Having trouble compiling FreeRTOS for STM32

Posted by matben243 on January 13, 2015

Hi all, I am having trouble compiling FreeRTOS into a simple LED flashing program I was able to compile and run on my STM32-H103 board. I have 4 make files. 1 to compile my libs directory, 1 to compile my src directory, 1 to compile the entire project, and 1 common make file. The src, entire project, and common make file are shown below. I am getting the following compile errors.

src/app.a(startup.o):(.isrvectors+0x2c): undefined reference to vPortSVCHandler' src/app.a(startup.o):(.isr_vectors+0x38): undefined reference toxPortPendSVHandler' src/app.a(startup.o):(.isrvectors+0x3c): undefined reference to xPortSysTickHandler' src/app.a(main.o): In functionmain': /home/matthew/Work/22_ARM-Firmware/HomeAutomationControllerPrototype/src/main.c:36: undefined reference to xTaskGenericCreate' /home/matthew/Work/22_ARM-Firmware/HomeAutomationControllerPrototype/src/main.c:37: undefined reference tovTaskStartScheduler'


src Makefile

include ../Makefile.common

OBJS+=startup.o OBJS+=main.o OBJS+=FreeRTOS.o

all: src

src: app.a

FreeRTOS.o: FreeRTOS/Source/timers.c FreeRTOS/Source/tasks.c FreeRTOS/Source/queue.c FreeRTOS/Source/list.c FreeRTOS/Source/eventgroups.c FreeRTOS/Source/croutine.c FreeRTOS/Source/portable/GCC/ARMCM3/port.c $(CC) -c $(CFLAGS) $< -o $@

app.a: $(OBJS) $(AR) cr app.a $(OBJS)

.PHONY: src clean tshow

clean: rm -f app.a $(OBJS)


general Makefile

include Makefile.common LDFLAGS=$(COMMONFLAGS) -fno-exceptions -ffunction-sections -fdata-sections -L$(LIBDIR) -nostartfiles -Wl,--gc-sections,-Tlinker.ld

LDLIBS+=-lm LDLIBS+=-lstm32

STARTUP=startup.c

all: libs src $(CC) -o $(PROGRAM).elf $(LDFLAGS) -Wl,--whole-archive src/app.a -Wl,--no-whole-archive $(LDLIBS) $(OBJCOPY) -O ihex $(PROGRAM).elf $(PROGRAM).hex $(OBJCOPY) -O binary $(PROGRAM).elf $(PROGRAM).bin

arm-none-eabi-readelf -a $(PROGRAM).elf > $(PROGRAM).info_elf
arm-none-eabi-size -d -B -t $(PROGRAM).elf > $(PROGRAM).info_size
arm-none-eabi-objdump -S $(PROGRAM).elf > $(PROGRAM).info_code
arm-none-eabi-nm -t x -S --numeric-sort -s $(PROGRAM).elf > $(PROGRAM).info_symbol

.PHONY: libs src clean tshow

libs: $(MAKE) -C libs $@

src: $(MAKE) -C src $@

clean: $(MAKE) -C src $@ $(MAKE) -C libs $@ rm -f $(PROGRAM).elf $(PROGRAM).hex $(PROGRAM).bin $(PROGRAM).infoelf $(PROGRAM).infosize rm -f $(PROGRAM).infocode rm -f $(PROGRAM).infosymbol


common Makefile

TOP=$(shell readlink -f "$(dir $(lastword $(MAKEFILE_LIST)))") PROGRAM=main LIBDIR=$(TOP)/libs FREERTOSDIR=$(TOP)/src/FreeRTOS/Source

STMLIB=$(LIBDIR)/STM32F10xStdPeriphLib_V3.6.1/Libraries

TypeOfMCU=STM32F10X_MD

TC=arm-none-eabi CC=$(TC)-gcc LD=$(TC)-ld -v OBJCOPY=$(TC)-objcopy AR=$(TC)-ar GDB=$(TC)-gdb

INCLUDE=-I$(TOP)/inc INCLUDE+=-I$(STMLIB)/CMSIS/Include INCLUDE+=-I$(STMLIB)/CMSIS/Device/ST/STM32F10x/Include INCLUDE+=-I$(STMLIB)/CMSIS/Device/ST/STM32F10x/Source/Templates INCLUDE+=-I$(STMLIB)/STM32F10xStdPeriphDriver/inc INCLUDE+=-I$(STMLIB)/STM32USB-FS-DeviceDriver/inc INCLUDE+=-I$(FREERTOSDIR)/include INCLUDE+=-I$(FREERTOSDIR)/portable/GCC/ARM_CM3 INCLUDE+=-I$(TOP)/src

COMMONFLAGS=-g -mcpu=cortex-m3 -mthumb COMMONFLAGSlib=$(COMMONFLAGS)

ifeq ($(OptSRC),0) COMMONFLAGS+=-O0 InfoTextSrc=src (no optimize, -O0) else ifeq ($(OptSRC),1) COMMONFLAGS+=-O1 InfoTextSrc=src (optimize time+ size+, -O1) else ifeq ($(OptSRC),2) COMMONFLAGS+=-O2 InfoTextSrc=src (optimize time++ size+, -O2) else ifeq ($(OptSRC),s) COMMONFLAGS+=-Os InfoTextSrc=src (optimize size++, -Os) else ifeq ($(OptSRC),3) COMMONFLAGS+=-O3 InfoTextSrc=src (full optimize, -O3) else COMMONFLAGS+=-O3 CFLAGS += -D RELEASEPUBLIC InfoTextSrc=src (full optimize and readout protected, -O4) endif CFLAGS+=$(COMMONFLAGS) -Wall -Werror $(INCLUDE) CFLAGS+=-D $(TypeOfMCU) CFLAGS+=-D VECTTAB_FLASH

ifeq ($(OptLIB),0) COMMONFLAGSlib+=-O0 InfoTextLib=libs (no optimize, -O0) else ifeq ($(OptLIB),1) COMMONFLAGSlib+=-O1 InfoTextLib=libs (optimize time+ size+, -O1) else ifeq ($(OptLIB),2) COMMONFLAGSlib+=-O2 InfoTextLib=libs (optimize time++ size+, -O2) else ifeq ($(OptLIB),s) COMMONFLAGSlib+=-Os InfoTextLib=libs (optimize size++, -Os) else COMMONFLAGSlib+=-O3 InfoTextLib=libs (full optimize, -O3) endif CFLAGSlib+=$(COMMONFLAGSlib) -Wall -Werror $(INCLUDE) CFLAGSlib+=-D $(TypeOfMCU) CFLAGSlib+=-D VECTTABFLASH


Having trouble compiling FreeRTOS for STM32

Posted by rtel on January 13, 2015

The errors would seem to indicate that FreeRTOSSourceportableGCCARM_CM3port.c is not being compiled into the library correctly. Can you use binutils to dump the contents of app.a to see if they are in there?

I would also recommend not using the -ffunction-sections -fdata-sections compiler options when building the library. It may well be fine to do that as the library should not remove any symbols, I'm just not sure.

Regards.


Having trouble compiling FreeRTOS for STM32

Posted by matben243 on January 13, 2015

Hi, thanks for your help. The dump of app.a is shown below. I can see some FreeRTOS functions inside there, although I assume there should be more? Just to be clear using make with the src make file works with no errors, it is once I call make with the project make file that I get the linker errors.

In archive app.a:

startup.o: file format elf32-littlearm

Disassembly of section .text:

00000000 : 0: e7fe b.n 0 2: bf00 nop

00000004 : 4: 4668 mov r0, sp 6: f020 0107 bic.w r1, r0, #7 a: 468d mov sp, r1 c: b501 push {r0, lr} e: f240 0100 movw r1, #0 12: f240 0000 movw r0, #0 16: f2c0 0100 movt r1, #0 1a: f2c0 0000 movt r0, #0 1e: 4281 cmp r1, r0 20: d00c beq.n 3c 22: f240 0300 movw r3, #0 26: f2c0 0300 movt r3, #0 2a: 4298 cmp r0, r3 2c: d206 bcs.n 3c 2e: 43c2 mvns r2, r0 30: 4413 add r3, r2 32: f023 0203 bic.w r2, r3, #3 36: 3204 adds r2, #4 38: f7ff fffe bl 0 3c: f240 0000 movw r0, #0 40: f240 0300 movw r3, #0 44: f2c0 0000 movt r0, #0 48: f2c0 0300 movt r3, #0 4c: 4298 cmp r0, r3 4e: d207 bcs.n 60 50: 43c2 mvns r2, r0 52: 4413 add r3, r2 54: f023 0203 bic.w r2, r3, #3 58: 3204 adds r2, #4 5a: 2100 movs r1, #0 5c: f7ff fffe bl 0 60: f240 0300 movw r3, #0 64: f2c0 0300 movt r3, #0 68: f023 4368 bic.w r3, r3, #3892314112 ; 0xe8000000 6c: f023 027f bic.w r2, r3, #127 ; 0x7f 70: f44f 436d mov.w r3, #60672 ; 0xed00 74: f042 6200 orr.w r2, r2, #134217728 ; 0x8000000 78: f2ce 0300 movt r3, #57344 ; 0xe000 7c: 609a str r2, [r3, #8] 7e: f7ff fffe bl 0 82: f7ff fffe bl 0

86: e7fe b.n 0 <_sidata>

00000088 <Init_Data>: 88: f240 0100 movw r1, #0 8c: f240 0000 movw r0, #0 90: f2c0 0100 movt r1, #0 94: f2c0 0000 movt r0, #0 98: 4281 cmp r1, r0 9a: b508 push {r3, lr} 9c: d00c beq.n b8 <InitData+0x30> 9e: f240 0300 movw r3, #0 a2: f2c0 0300 movt r3, #0 a6: 4298 cmp r0, r3 a8: d206 bcs.n b8 <__InitData+0x30> aa: 43c2 mvns r2, r0 ac: 4413 add r3, r2 ae: f023 0203 bic.w r2, r3, #3 b2: 3204 adds r2, #4 b4: f7ff fffe bl 0 b8: f240 0000 movw r0, #0 bc: f240 0300 movw r3, #0 c0: f2c0 0000 movt r0, #0 c4: f2c0 0300 movt r3, #0 c8: 4298 cmp r0, r3 ca: d209 bcs.n e0 <_InitData+0x58> cc: 43c2 mvns r2, r0 ce: 4413 add r3, r2 d0: f023 0203 bic.w r2, r3, #3 d4: 3204 adds r2, #4 d6: 2100 movs r1, #0 d8: e8bd 4008 ldmia.w sp!, {r3, lr} dc: f7ff bffe b.w 0 e0: bd08 pop {r3, pc} e2: bf00 nop

main.o: file format elf32-littlearm

Disassembly of section .text:

00000000 : 0: f44f 5580 mov.w r5, #4096 ; 0x1000 4: b580 push {r7, lr} 6: f2c4 0501 movt r5, #16385 ; 0x4001 a: f44f 5780 mov.w r7, #4096 ; 0x1000 e: f04f 5680 mov.w r6, #268435456 ; 0x10000000 12: 2400 movs r4, #0 14: f2c4 2448 movt r4, #16968 ; 0x4248 18: 612f str r7, [r5, #16] 1a: f240 3147 movw r1, #839 ; 0x347 1e: 4620 mov r0, r4 20: f6c3 7180 movt r1, #16256 ; 0x3f80 24: f7ff fffe bl 0 <aeabi_fdiv> 28: f24b 7117 movw r1, #46871 ; 0xb717 2c: f6c3 01d1 movt r1, #14545 ; 0x38d1 30: 4604 mov r4, r0 32: f7ff fffe bl 0 <aeabifcmpgt> 36: 2800 cmp r0, #0 38: d1ef bne.n 1a 3a: 2400 movs r4, #0 3c: f2c4 2448 movt r4, #16968 ; 0x4248 40: 612e str r6, [r5, #16] 42: f240 3147 movw r1, #839 ; 0x347 46: 4620 mov r0, r4 48: f6c3 7180 movt r1, #16256 ; 0x3f80 4c: f7ff fffe bl 0 <__aeabifdiv> 50: f24b 7117 movw r1, #46871 ; 0xb717 54: f6c3 01d1 movt r1, #14545 ; 0x38d1 58: 4604 mov r4, r0 5a: f7ff fffe bl 0 <_aeabifcmpgt> 5e: 2800 cmp r0, #0 60: d1ef bne.n 42 62: e7d6 b.n 12

00000064 : 64: b510 push {r4, lr} 66: 2400 movs r4, #0 68: f2c4 2448 movt r4, #16968 ; 0x4248 6c: f240 3147 movw r1, #839 ; 0x347 70: 4620 mov r0, r4 72: f6c3 7180 movt r1, #16256 ; 0x3f80 76: f7ff fffe bl 0 <aeabi_fdiv> 7a: f24b 7117 movw r1, #46871 ; 0xb717 7e: f6c3 01d1 movt r1, #14545 ; 0x38d1 82: 4604 mov r4, r0 84: f7ff fffe bl 0 <aeabi_fcmpgt> 88: 2800 cmp r0, #0 8a: d1ef bne.n 6c 8c: bd10 pop {r4, pc} 8e: bf00 nop

00000090 : 90: b508 push {r3, lr} 92: f7ff fffe bl 0 96: 2801 cmp r0, #1 98: d006 beq.n a8 9a: f7ff fffe bl 0 9e: 2001 movs r0, #1 a0: f7ff fffe bl 0 a4: 2804 cmp r0, #4 a6: d000 beq.n aa a8: bd08 pop {r3, pc} aa: f3bf 8f4f dsb sy ae: f44f 426d mov.w r2, #60672 ; 0xed00 b2: f2ce 0200 movt r2, #57344 ; 0xe000 b6: 68d1 ldr r1, [r2, #12] b8: 2304 movs r3, #4 ba: f401 61e0 and.w r1, r1, #1792 ; 0x700 be: f2c0 53fa movt r3, #1530 ; 0x5fa c2: 430b orrs r3, r1 c4: 60d3 str r3, [r2, #12] c6: f3bf 8f4f dsb sy ca: e7fe b.n ca

Disassembly of section .text.startup:

00000000

: 0: b510 push {r4, lr} 2: 2010 movs r0, #16 4: b086 sub sp, #24 6: 2101 movs r1, #1 8: f7ff fffe bl 0 c: f44f 5080 mov.w r0, #4096 ; 0x1000 10: 2202 movs r2, #2 12: 2310 movs r3, #16 14: f2c4 0001 movt r0, #16385 ; 0x4001 18: a905 add r1, sp, #20 1a: f44f 5480 mov.w r4, #4096 ; 0x1000 1e: f88d 2016 strb.w r2, [sp, #22] 22: f88d 3017 strb.w r3, [sp, #23] 26: f8ad 4014 strh.w r4, [sp, #20] 2a: f7ff fffe bl 0 2e: f7ff fffe bl 90 32: 2300 movs r3, #0 34: f240 0000 movw r0, #0 38: f240 0100 movw r1, #0 3c: 9300 str r3, [sp, #0] 3e: 9301 str r3, [sp, #4] 40: 9302 str r3, [sp, #8] 42: 9303 str r3, [sp, #12] 44: f2c0 0100 movt r1, #0 48: 2282 movs r2, #130 ; 0x82 4a: f2c0 0000 movt r0, #0 4e: f7ff fffe bl 0 52: f7ff fffe bl 0 56: e7fe b.n 56

FreeRTOS.o: file format elf32-littlearm

Disassembly of section .text:

00000000 : 0: b5f0 push {r4, r5, r6, r7, lr} 2: f240 0400 movw r4, #0 6: b085 sub sp, #20 8: f2c0 0400 movt r4, #0 c: f7ff fffe bl 0 10: 6827 ldr r7, [r4, #0] 12: b1c7 cbz r7, 46 14: f7ff fffe bl 0 18: 6823 ldr r3, [r4, #0] 1a: b38b cbz r3, 80 1c: 2300 movs r3, #0 1e: 2202 movs r2, #2 20: f240 0000 movw r0, #0 24: f240 0100 movw r1, #0 28: e88d 000c stmia.w sp, {r2, r3} 2c: 9302 str r3, [sp, #8] 2e: 9303 str r3, [sp, #12] 30: f2c0 0000 movt r0, #0 34: f2c0 0100 movt r1, #0 38: f44f 7282 mov.w r2, #260 ; 0x104 3c: f7ff fffe bl 0 40: b1f0 cbz r0, 80 42: b005 add sp, #20 44: bdf0 pop {r4, r5, r6, r7, pc} 46: 1d26 adds r6, r4, #4 48: 4630 mov r0, r6 4a: f104 0518 add.w r5, r4, #24 4e: f7ff fffe bl 0 52: 4628 mov r0, r5 54: f7ff fffe bl 0 58: 463a mov r2, r7 5a: 200a movs r0, #10 5c: 210c movs r1, #12 5e: 62e6 str r6, [r4, #44] ; 0x2c 60: 6325 str r5, [r4, #48] ; 0x30 62: f7ff fffe bl 0 66: 6020 str r0, [r4, #0] 68: b168 cbz r0, 86 6a: f240 0100 movw r1, #0 6e: f2c0 0100 movt r1, #0 72: f7ff fffe bl 0 76: f7ff fffe bl 0 7a: 6823 ldr r3, [r4, #0] 7c: 2b00 cmp r3, #0 7e: d1cd bne.n 1c 80: f7ff fffe bl 0 84: e7fe b.n 0 86: f7ff fffe bl 0 8a: e7fe b.n 8a

0000008c : 8c: e92d 4ff0 stmdb sp!, {r4, r5, r6, r7, r8, r9, sl, fp, lr} 90: 460e mov r6, r1 92: b083 sub sp, #12 94: 4683 mov fp, r0 96: 4692 mov sl, r2 98: 461f mov r7, r3 9a: b1e9 cbz r1, d8 9c: 202c movs r0, #44 ; 0x2c 9e: f7ff fffe bl 0 a2: 4604 mov r4, r0 a4: b1a0 cbz r0, d0 a6: f240 0500 movw r5, #0 aa: f2c0 0500 movt r5, #0 ae: f7ff fffe bl 0 b2: 682a ldr r2, [r5, #0] b4: b19a cbz r2, de b6: f7ff fffe bl 0 ba: 9b0c ldr r3, [sp, #48] ; 0x30 bc: f8c4 b000 str.w fp, [r4] c0: 61a6 str r6, [r4, #24] c2: f8c4 a01c str.w sl, [r4, #28] c6: 6227 str r7, [r4, #32] c8: 6263 str r3, [r4, #36] ; 0x24 ca: 1d20 adds r0, r4, #4 cc: f7ff fffe bl 0 d0: 4620 mov r0, r4 d2: b003 add sp, #12 d4: e8bd 8ff0 ldmia.w sp!, {r4, r5, r6, r7, r8, r9, sl, fp, pc} d8: f7ff fffe bl 0 dc: e7fe b.n dc de: f105 0904 add.w r9, r5, #4 e2: 4648 mov r0, r9 e4: f105 0818 add.w r8, r5, #24 e8: 9201 str r2, [sp, #4] ea: f7ff fffe bl 0 ee: 4640 mov r0, r8 f0: f7ff fffe bl 0 f4: 9a01 ldr r2, [sp, #4] f6: 200a movs r0, #10 f8: 210c movs r1, #12 fa: f8c5 902c str.w r9, [r5, #44] ; 0x2c fe: f8c5 8030 str.w r8, [r5, #48] ; 0x30 102: f7ff fffe bl 0 106: 6028 str r0, [r5, #0] 108: b130 cbz r0, 118 10a: f240 0100 movw r1, #0 10e: f2c0 0100 movt r1, #0 112: f7ff fffe bl 0 116: e7ce b.n ffffffa0 118: f7ff fffe bl 0 11c: e7fe b.n 11c 11e: bf00 nop

00000120 : 120: b570 push {r4, r5, r6, lr} 122: f240 0400 movw r4, #0 126: f2c0 0400 movt r4, #0 12a: 6825 ldr r5, [r4, #0] 12c: b084 sub sp, #16 12e: b1ed cbz r5, 16c 130: 2905 cmp r1, #5 132: 9101 str r1, [sp, #4] 134: 9202 str r2, [sp, #8] 136: 9003 str r0, [sp, #12] 138: dd07 ble.n 14a 13a: 461a mov r2, r3 13c: 4628 mov r0, r5 13e: a901 add r1, sp, #4 140: 2300 movs r3, #0 142: f7ff fffe bl 0 146: b004 add sp, #16 148: bd70 pop {r4, r5, r6, pc} 14a: f7ff fffe bl 0 14e: 2802 cmp r0, #2 150: bf11 iteee ne 152: 2200 movne r2, #0 154: 6820 ldreq r0, [r4, #0] 156: a901 addeq r1, sp, #4 158: 9a08 ldreq r2, [sp, #32] 15a: bf0f iteee eq 15c: 2300 moveq r3, #0 15e: 6820 ldrne r0, [r4, #0] 160: 4613 movne r3, r2 162: a901 addne r1, sp, #4 164: f7ff fffe bl 0 168: b004 add sp, #16 16a: bd70 pop {r4, r5, r6, pc} 16c: 4628 mov r0, r5 16e: b004 add sp, #16 170: bd70 pop {r4, r5, r6, pc} 172: bf00 nop

00000174 : 174: e92d 4ff0 stmdb sp!, {r4, r5, r6, r7, r8, r9, sl, fp, lr} 178: f240 0400 movw r4, #0 17c: f2c0 0400 movt r4, #0 180: b089 sub sp, #36 ; 0x24 182: 4627 mov r7, r4 184: 6ae3 ldr r3, [r4, #44] ; 0x2c 186: 2600 movs r6, #0 188: 681d ldr r5, [r3, #0] 18a: f1d5 0501 rsbs r5, r5, #1 18e: bf38 it cc 190: 2500 movcc r5, #0 192: b90d cbnz r5, 198 194: 68db ldr r3, [r3, #12] 196: 681e ldr r6, [r3, #0] 198: f7ff fffe bl 0 19c: f7ff fffe bl 0 1a0: 6b63 ldr r3, [r4, #52] ; 0x34 1a2: 4682 mov sl, r0 1a4: 4298 cmp r0, r3 1a6: d352 bcc.n 24e 1a8: f085 0301 eor.w r3, r5, #1 1ac: 4286 cmp r6, r0 1ae: bf8c ite hi 1b0: 2300 movhi r3, #0 1b2: f003 0301 andls.w r3, r3, #1 1b6: 6378 str r0, [r7, #52] ; 0x34 1b8: 2b00 cmp r3, #0 1ba: d175 bne.n 2a8 1bc: ebca 0106 rsb r1, sl, r6 1c0: 6838 ldr r0, [r7, #0] 1c2: f7ff fffe bl 0 1c6: f7ff fffe bl 0 1ca: 2800 cmp r0, #0 1cc: f000 8094 beq.w 2f8 1d0: 2200 movs r2, #0 1d2: 4613 mov r3, r2 1d4: 6820 ldr r0, [r4, #0] 1d6: a902 add r1, sp, #8 1d8: f7ff fffe bl 0 1dc: 2800 cmp r0, #0 1de: d0d1 beq.n 184 1e0: 9b02 ldr r3, [sp, #8] 1e2: 2b00 cmp r3, #0 1e4: dbf4 blt.n 1d0 1e6: f8dd a010 ldr.w sl, [sp, #16] 1ea: f8da 3014 ldr.w r3, [sl, #20] 1ee: b11b cbz r3, 1f8 1f0: f10a 0004 add.w r0, sl, #4 1f4: f7ff fffe bl 0 1f8: f7ff fffe bl 0 1fc: 6b63 ldr r3, [r4, #52] ; 0x34 1fe: 4683 mov fp, r0 200: 4298 cmp r0, r3 202: d342 bcc.n 28a 204: 9b02 ldr r3, [sp, #8] 206: f8c4 b034 str.w fp, [r4, #52] ; 0x34 20a: 2b09 cmp r3, #9 20c: d8e0 bhi.n 1d0 20e: 2001 movs r0, #1 210: fa00 f303 lsl.w r3, r0, r3 214: f413 7f04 tst.w r3, #528 ; 0x210 218: f040 80e9 bne.w 3ee 21c: f013 0fc7 tst.w r3, #199 ; 0xc7 220: f040 80be bne.w 3a0 224: 069b lsls r3, r3, #26 226: d5d3 bpl.n 1d0 228: 4650 mov r0, sl 22a: f7ff fffe bl 0 22e: e7cf b.n 1d0 230: 68db ldr r3, [r3, #12] 232: 68dd ldr r5, [r3, #12] 234: f8d3 b000 ldr.w fp, [r3] 238: f105 0804 add.w r8, r5, #4 23c: 4640 mov r0, r8 23e: f7ff fffe bl 0 242: 6a6b ldr r3, [r5, #36] ; 0x24 244: 4628 mov r0, r5 246: 4798 blx r3 248: 69eb ldr r3, [r5, #28] 24a: 2b01 cmp r3, #1 24c: d03d beq.n 2ca 24e: 6ae3 ldr r3, [r4, #44] ; 0x2c 250: f240 0600 movw r6, #0 254: 681a ldr r2, [r3, #0] 256: f2c0 0600 movt r6, #0 25a: 2a00 cmp r2, #0 25c: d1e8 bne.n 230 25e: 6b32 ldr r2, [r6, #48] ; 0x30 260: f8c6 a034 str.w sl, [r6, #52] ; 0x34 264: 62f2 str r2, [r6, #44] ; 0x2c 266: 6333 str r3, [r6, #48] ; 0x30 268: f7ff fffe bl 0 26c: e7b0 b.n 1d0 26e: 68d2 ldr r2, [r2, #12] 270: 68d5 ldr r5, [r2, #12] 272: 6816 ldr r6, [r2, #0] 274: f105 0804 add.w r8, r5, #4 278: 4640 mov r0, r8 27a: f7ff fffe bl 0 27e: 6a6a ldr r2, [r5, #36] ; 0x24 280: 4628 mov r0, r5 282: 4790 blx r2 284: 69ea ldr r2, [r5, #28] 286: 2a01 cmp r2, #1 288: d02a beq.n 2e0 28a: 6ae2 ldr r2, [r4, #44] ; 0x2c 28c: f240 0900 movw r9, #0 290: 6811 ldr r1, [r2, #0] 292: f2c0 0900 movt r9, #0 296: 2900 cmp r1, #0 298: d1e9 bne.n 26e 29a: f8d9 1030 ldr.w r1, [r9, #48] ; 0x30 29e: f8c9 2030 str.w r2, [r9, #48] ; 0x30 2a2: f8c9 102c str.w r1, [r9, #44] ; 0x2c 2a6: e7ad b.n ffffff5e 2a8: f7ff fffe bl 0 2ac: 6afb ldr r3, [r7, #44] ; 0x2c 2ae: 68db ldr r3, [r3, #12] 2b0: 68dd ldr r5, [r3, #12] 2b2: f105 0b04 add.w fp, r5, #4 2b6: 4658 mov r0, fp 2b8: f7ff fffe bl 0 2bc: 69eb ldr r3, [r5, #28] 2be: 2b01 cmp r3, #1 2c0: d01d beq.n 2fe 2c2: 6a6b ldr r3, [r5, #36] ; 0x24 2c4: 4628 mov r0, r5 2c6: 4798 blx r3 2c8: e782 b.n 1d0 2ca: 69ab ldr r3, [r5, #24] 2cc: 4641 mov r1, r8 2ce: 445b add r3, fp 2d0: 455b cmp r3, fp 2d2: d931 bls.n 338 2d4: 606b str r3, [r5, #4] 2d6: 612d str r5, [r5, #16] 2d8: 6af0 ldr r0, [r6, #44] ; 0x2c 2da: f7ff fffe bl 0 2de: e7b6 b.n 24e 2e0: 69aa ldr r2, [r5, #24] 2e2: 4641 mov r1, r8 2e4: 4432 add r2, r6 2e6: 42b2 cmp r2, r6 2e8: d93b bls.n 362 2ea: 606a str r2, [r5, #4] 2ec: 612d str r5, [r5, #16] 2ee: f8d9 002c ldr.w r0, [r9, #44] ; 0x2c 2f2: f7ff fffe bl 0 2f6: e7c8 b.n ffffff94 2f8: f7ff fffe bl 0 2fc: e768 b.n 1d0 2fe: 69ab ldr r3, [r5, #24] 300: 612d str r5, [r5, #16] 302: 18f2 adds r2, r6, r3 304: 4592 cmp sl, r2 306: 606a str r2, [r5, #4] 308: d340 bcc.n 38c 30a: ebc6 0a0a rsb sl, r6, sl 30e: 4553 cmp r3, sl 310: d841 bhi.n 396 312: 683b ldr r3, [r7, #0] 314: b16b cbz r3, 332 316: 2200 movs r2, #0 318: 9205 str r2, [sp, #20] 31a: 9606 str r6, [sp, #24] 31c: 9507 str r5, [sp, #28] 31e: f7ff fffe bl 0 322: 2200 movs r2, #0 324: 4613 mov r3, r2 326: 6838 ldr r0, [r7, #0] 328: a905 add r1, sp, #20 32a: f7ff fffe bl 0 32e: 2800 cmp r0, #0 330: d1c7 bne.n 2c2 332: f7ff fffe bl 0 336: e7fe b.n 336 338: 6833 ldr r3, [r6, #0] 33a: b17b cbz r3, 35c 33c: 2000 movs r0, #0 33e: 9005 str r0, [sp, #20] 340: f8cd b018 str.w fp, [sp, #24] 344: 9507 str r5, [sp, #28] 346: f7ff fffe bl 0 34a: 2200 movs r2, #0 34c: 6830 ldr r0, [r6, #0] 34e: 4613 mov r3, r2 350: a905 add r1, sp, #20 352: f7ff fffe bl 0 356: 2800 cmp r0, #0 358: f47f af79 bne.w 24e 35c: f7ff fffe bl 0 360: e7fe b.n 360 362: f8d9 2000 ldr.w r2, [r9] 366: b172 cbz r2, 386 368: 2300 movs r3, #0 36a: 9305 str r3, [sp, #20] 36c: 9606 str r6, [sp, #24] 36e: 9507 str r5, [sp, #28] 370: f7ff fffe bl 0 374: 2200 movs r2, #0 376: f8d9 0000 ldr.w r0, [r9] 37a: 4613 mov r3, r2 37c: a905 add r1, sp, #20 37e: f7ff fffe bl 0 382: 2800 cmp r0, #0 384: d181 bne.n 28a 386: f7ff fffe bl 0 38a: e7fe b.n 38a 38c: 4659 mov r1, fp 38e: 6af8 ldr r0, [r7, #44] ; 0x2c 390: f7ff fffe bl 0 394: e795 b.n 2c2 396: 4659 mov r1, fp 398: 6b38 ldr r0, [r7, #48] ; 0x30 39a: f7ff fffe bl 0 39e: e790 b.n 2c2 3a0: 9b03 ldr r3, [sp, #12] 3a2: f8da 1018 ldr.w r1, [sl, #24] 3a6: f8ca a010 str.w sl, [sl, #16] 3aa: 18ca adds r2, r1, r3 3ac: 455a cmp r2, fp 3ae: f8ca 2004 str.w r2, [sl, #4] 3b2: d82e bhi.n 412 3b4: ebc3 030b rsb r3, r3, fp 3b8: 4299 cmp r1, r3 3ba: d839 bhi.n 430 3bc: f8da 3024 ldr.w r3, [sl, #36] ; 0x24 3c0: 4650 mov r0, sl 3c2: 4798 blx r3 3c4: f8da 301c ldr.w r3, [sl, #28] 3c8: 2b01 cmp r3, #1 3ca: f47f af01 bne.w 1d0 3ce: f8da 2018 ldr.w r2, [sl, #24] 3d2: 9b03 ldr r3, [sp, #12] 3d4: 2100 movs r1, #0 3d6: 441a add r2, r3 3d8: 9100 str r1, [sp, #0] 3da: 4650 mov r0, sl 3dc: 460b mov r3, r1 3de: f7ff fffe bl 120 3e2: 2800 cmp r0, #0 3e4: f47f aef4 bne.w 1d0 3e8: f7ff fffe bl 0 3ec: e7fe b.n 3ec 3ee: 9b03 ldr r3, [sp, #12] 3f0: f8ca 3018 str.w r3, [sl, #24] 3f4: b313 cbz r3, 43c 3f6: 445b add r3, fp 3f8: 455b cmp r3, fp 3fa: f8ca 3004 str.w r3, [sl, #4] 3fe: f8ca a010 str.w sl, [sl, #16] 402: f10a 0104 add.w r1, sl, #4 406: bf94 ite ls 408: 6b38 ldrls r0, [r7, #48] ; 0x30 40a: 6af8 ldrhi r0, [r7, #44] ; 0x2c 40c: f7ff fffe bl 0 410: e6de b.n 1d0 412: 455b cmp r3, fp 414: bf94 ite ls 416: 2100 movls r1, #0 418: 2101 movhi r1, #1 41a: 4293 cmp r3, r2 41c: bf88 it hi 41e: 2100 movhi r1, #0 420: 2900 cmp r1, #0 422: d1cb bne.n 3bc 424: f10a 0104 add.w r1, sl, #4 428: 6af8 ldr r0, [r7, #44] ; 0x2c 42a: f7ff fffe bl 0 42e: e6cf b.n 1d0 430: f10a 0104 add.w r1, sl, #4 434: 6b38 ldr r0, [r7, #48] ; 0x30 436: f7ff fffe bl 0 43a: e6c9 b.n fffffd96 43c: f7ff fffe bl 0 440: e7fe b.n 440 442: bf00 nop

00000444 : 444: 6800 ldr r0, [r0, #0] 446: 4770 bx lr

00000448 : 448: b510 push {r4, lr} 44a: 4604 mov r4, r0 44c: f7ff fffe bl 0 450: 6964 ldr r4, [r4, #20] 452: 3400 adds r4, #0 454: bf18 it ne 456: 2401 movne r4, #1 458: f7ff fffe bl 0 45c: 4620 mov r0, r4 45e: bd10 pop {r4, pc}

00000460 : 460: 6a00 ldr r0, [r0, #32] 462: 4770 bx lr


Having trouble compiling FreeRTOS for STM32

Posted by matben243 on January 13, 2015

I think my problem may be due to trying to compile multiple .c files into a single .o file. I may have to make it a library or something. Not quite sure how.


Having trouble compiling FreeRTOS for STM32

Posted by heinbali01 on January 14, 2015

Hi Matt,

trying to compile multiple .c files into a single .o file

that sounds like the right conclusion.

Here a rule that I often use in my projects:

~~~~~ # A rule to build an .o from a pair .c and .d %.o: %.c %.d @echo Compiling $< $(CC) -c $(CFLAGS) -MMD -MP -MT "$.i $.x $*.o" -o $@ $< ~~~~~

Beside compiling, this rule also creates a dependency file (*.d) for each file, so .d is both an input as well as an output.

Let CFLAGS also include -ffunction-sections and -fdata-sections. With these options every function will get located in its own text segment and each data object gets its own data segment. Now while linking, only those functions that are really called, and only those data objects that are referred to, will be linked into your program. Without these compiler options, all functions would go to a single section .text and all data would go to .data or .bss.

I am not a fan of using libraries, unless you're working in a team and others are not allowed to see your source code. You can give them header files and a library (.h and .a). Now when a header .h is out-of-sync with a library .a, you can expect big problems at runtime.

Regards.


[ 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