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


vRegisterCheck fails for 8051 port

Posted by Florencio Villasenor on February 5, 2010
I am porting freeRTOS to Silicon Labs 8051F125. I used the latest SDCC compiler (2.9.4) and down loaded the libraries from www.freertos.org/reentrant_lib.zip. This did NOT work, so I rebuild the libraries using the following makefile:

# Make file to build SDCC libraries for the 8051 processor
# (my target processor is the 8051F125 by Si Labs)
# Using 2.9.4 #5582 (Dec 7 2009) version of SDCC
# Uses large model, auto stack and are reentrant.
# These libraries are need with the latest (6.0.1) FreeRTOS
# form www.freertos.org
# place this Makefile in SDCC/lib/src
# and run make
# will place libraries in SDCC/lib/large-stack-auto
# MAKE SURE SDCC/lib/large-stack-auto EXISTS BEFORE
# running make!
# using make from http://unxutils.sourceforge.net/
# by Florencio Villasenor Jr. 2009 Dec


# Add if needed
--nogcse --noinvariant --noinduction --nojtbound --noloopreverse \
--nolabelopt --nooverlay --peep-asm
#DEBUG=--debug $(NO_OPT)

-DSDCC_CYGNAL $(DEBUG) --less-pedantic --model-large \
--xram-size 8448 --stack-auto --int-long-reent --float-reent \


MCS51_DIR = mcs51
LIB_DIR = ../large-stack-auto

_divsint _divuint _modsint _moduint _mulint
INT_OBJ = $(addsuffix .rel,$(INT_NAMES))

_divslong _divulong _modslong _modulong _mullong
LONG_OBJ = $(addsuffix .rel,$(LONG_NAMES))

_atof _fsadd _fsdiv _fseq _fsgt _fslt _fsmul _fsneq _fssub _uchar2fs \
_uint2fs _ulong2fs _schar2fs _sint2fs _slong2fs _fs2uchar _fs2uint \
_fs2ulong _fs2schar _fs2sint _fs2slong _fsget1arg _fsget2args \
_fsrshift _fsnormalize _fsreturnval _fsswapargs _fscmp fabsf frexpf \
ldexpf expf powf sincosf sinf cosf logf log10f sqrtf tancotf tanf cotf \
asincosf asinf acosf atanf atan2f sincoshf sinhf coshf tanhf floorf \
ceilf modff errno
FLOAT_OBJ = $(addsuffix .rel,$(FLOAT_NAMES))

_iscntrl _isdigit _isgraph _islower _isprint _ispunct _isspace \
_isupper _isxdigit _itoa _ltoa _strchr _strcmp _strcpy _strcspn \
_strlen _strcat _strncat _strncmp _strncpy _strpbrk _strrchr _strspn \
_strstr _strtok _memcmp _memcpy _memmove _memset _gptrget _gptrgetc \
_gptrput _decdptr _bp _spx _atoi _atol _malloc serial _autobaud \
_startup _ser puts gets printfl printf_large printf_fast vprintf \
assert time bpx
SDCC_OBJ = $(addsuffix .rel,$(SDCC_NAMES))

crtstart crtxinit crtxclear crtclear crtxstack crtpagesfr
MCS51_OBJ = $(addprefix $(MCS51_DIR)/, $(addsuffix .rel,$(MCS51_NAMES)))

.PHONY: all
all: $(LIB_DIR)/libint.lib $(LIB_DIR)/liblong.lib\
$(LIB_DIR)/libfloat.lib $(LIB_DIR)/libsdcc.lib $(LIB_DIR)/mcs51.lib

# @echo at $@
# @echo pc $%
# @echo lt $<
# @echo qt $?
# @echo ct $^
# @echo pl $+
# @echo ln $|
# @echo st $*

$(LIB_DIR)/libint.lib: $(INT_OBJ)
sdcclib $@ $?
@echo ----------

$(LIB_DIR)/liblong.lib: $(LONG_OBJ)
sdcclib $@ $?
@echo ----------

$(LIB_DIR)/libfloat.lib: $(FLOAT_OBJ)
sdcclib $@ $?
@echo ----------

$(LIB_DIR)/libsdcc.lib: $(SDCC_OBJ)
sdcclib $@ $?
@echo ----------

$(LIB_DIR)/mcs51.lib: $(MCS51_OBJ)
sdcclib $@ $?
@echo ----------

%.rel: %.c Makefile
$(CC) $(CFLAGS) -c $< -o $*.rel
@echo ----

%.rel: %.asm Makefile
$(AS) $(ASFLAGS) $<
@echo ----

.PHONY: clean
clean: mostlyclean
rm -f *.rel $(LIB_DIR)/*.lib
rm -f $(MCS51_DIR)/*.rel

.PHONY: mostlyclean
rm -f *.adb *.asm *.lst *.sym
rm -f $(MCS51_DIR)/*.abd $(MCS51_DIR)/*.lst $(MCS51_DIR)/*.sym

I then downloaded the latest freeRTOS (6.0.2), compiled and linked it. Got the stack start from main.mem (0x21) and put in freeRTOSConfig.h (configSTACK_START). Recompiled and relinked, and loaded to my dev board.

It seems to run, but it fails the RegisterCheck() task, the stack pointer does NOT equal configSTACK_START, it is off by one (0x20).

Should I use another version of the SDCC compiler (2.4.0 or 2.5.0)?

Thanks for nay help,


RE: vRegisterCheck fails for 8051 port

Posted by Florencio Villasenor on February 5, 2010
OK, I'm now using SDCC 2.5.0 and it works!

Well the problem that I was having before, I'm no longer having it. The Com task is failing as is the semaphore, but the RegisterCheck task is not failing.

I'm now using SDCC 2.5.0 and the reentrant libraries from www.freertos.org/reentrant_lib.zip


[ 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