Andes Workshop http://forum.andestech.com/ |
|
C++ code add on FreeRTOS http://forum.andestech.com/viewtopic.php?f=12&t=1006 |
Page 1 of 1 |
Author: | jimmy [ Tue Dec 26, 2017 7:20 pm ] | ||
Post subject: | C++ code add on FreeRTOS | ||
Attachment: FreeRTOS programmed by C language. If C++ code wants to add in FreeRTOS, you should update steps as following. C++ code can merge into Andes FreeRTOS.1. Makefile : add define in Makefile : Code: C++ := $(CROSS_COMPILE)g++ add suffixes rules in Makefile: Code: %.o: %.cpp $(TRACE_C++) $(Q)$(C++) -c -MMD $(CFLAGS) -o $@ $< 2. add crtbegin.c/crtend.c files (attached files) into folder RTOSDemo_bsp and both file will be compiled into project. 3. call function "_crt_init"in Start.S: Code: ! System reset handler bal reset bal _crt_init ! Infinite loop, if returned accidently 1: b 1b 4. add code "void __cxa_atexit(void (*arg1)(void*), void* arg2, void* arg3) { } void* __dso_handle = (void*) &__dso_handle; " in startup-nds32.c: Code: #include "nds32_intrinsic.h" #include "nds32_defs.h" void __cxa_atexit(void (*arg1)(void*), void* arg2, void* arg3) { } void* __dso_handle = (void*) &__dso_handle; #ifndef VECTOR_BASE #define VECTOR_BASE 0x00000000 Please pay attention to following: C++ program can call C function but C program can't call C++ If you are curious above updates, you can check web site https://gcc.gnu.org/onlinedocs/gccint/I ... ation.html to know reason.
|
Page 1 of 1 | All times are UTC + 8 hours [ DST ] |
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ |