Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
303 views
in Technique[技术] by (71.8m points)

assembly - Issue Cross Compiling FreeRTOS program for ARM

I want to build FreeRTOS executables for my target which is a beaglebone black that has a AM335X ARM Cortex-A8 processor. I am running windows but i am using a virtual machine that runs linux debian 10 which is what i am cross compiling from. uname -a provides:

Linux debian 4.19.0-13-amd64 #1 SMP Debian 4.19.160-2 (2020-11-28) x86_64 GNU/Linux

I'm new to FreeRTOS so let me know if im going about this the wrong way. My plans is to write a FreeRtos program with C and and cross compile it and simply send over the executable to the beaglebone and run the executable. I tried this with a Hello world program succesfully so i figured it should be possible with a FreeRTOS program. I want to get this working on two different compilers since i want to test out both. The first one is arm-linux-gnueabihf-gcc and the second one is a bare metal version called gcc-arm-8.2-2019.01-x86_64-arm-eabi. My project can be found here: https://github.com/frank2597/FreeRTOS_BBB.git and as a shortcut my compiler option settings can be found in these two files:

https://github.com/frank2597/FreeRTOS_BBB/blob/master/source/CMakeLists.txt

https://github.com/frank2597/FreeRTOS_BBB/blob/master/source/toolchain.cmake

I am using Cmake to generate the makefile.Both cross compilers have troubles compiling with my testing.c freertos program. When i use the arm-linux-gnueabihf-gcc compiler i get various warnings and some undefined references but the compiler reaches 100%, the errors from the make command is presented below (cant post verbose output due to character limit):

    [  0%] Building C object application/CMakeFiles/src_application.dir/TaskLED2.c.o
    /home/frank/eclipse-workspace/FreeRTOS_BBB/source/src/application/TaskLED2.c: In function ‘vLED_blink_evBits_ActivateHook’:
    /home/frank/eclipse-workspace/FreeRTOS_BBB/source/src/application/TaskLED2.c:70:39: warning: variable ‘xResult’ set but not used [-Wunused-but-set-variable]
      BaseType_t xHigherPriorityTaskWoken, xResult;
                                           ^~~~~~~

    [  2%] Building C object application/CMakeFiles/src_application.dir/app_MultiSinkLogger.c.o
    /home/frank/eclipse-workspace/FreeRTOS_BBB/source/src/application/app_MultiSinkLogger.c: In function ‘vMultiSinkLoggerConsole_main’:
    /home/frank/eclipse-workspace/FreeRTOS_BBB/source/src/application/app_MultiSinkLogger.c:105:30: warning: initialization discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
                 char * q       = pMsg;
                                  ^~~~
    /home/frank/eclipse-workspace/FreeRTOS_BBB/source/src/application/app_MultiSinkLogger.c: In function ‘InitSerialisedLogPrintf’:
    /home/frank/eclipse-workspace/FreeRTOS_BBB/source/src/application/app_MultiSinkLogger.c:144:30: warning: returning ‘QueueHandle_t’ {aka ‘struct QueueDefinition *’} from a function with return type ‘uint32_t’ {aka ‘unsigned int’} makes integer from pointer without a cast [-Wint-conversion]
         return ConsoleInterafceQ = q;
                ~~~~~~~~~~~~~~~~~~^~~
    /home/frank/eclipse-workspace/FreeRTOS_BBB/source/src/application/app_MultiSinkLogger.c: In function ‘prvPrefixStringToMessage’:
    /home/frank/eclipse-workspace/FreeRTOS_BBB/source/src/application/app_MultiSinkLogger.c:153:14: warning: unused variable ‘rv’ [-Wunused-variable]
         uint32_t rv = pdFAIL;
                  ^~
    /home/frank/eclipse-workspace/FreeRTOS_BBB/source/src/application/app_MultiSinkLogger.c: In function ‘prvPrefixDebugStringToMessage’:
    /home/frank/eclipse-workspace/FreeRTOS_BBB/source/src/application/app_MultiSinkLogger.c:173:36: warning: format ‘%d’ expects argument of type ‘int’, but argument 7 has type ‘long unsigned int’ [-Wformat=]
             snprintf(pMsg,m,"%s:%s:%s:%d:%s",pcTaskName,pcFileName,pcFuncName,ulLine,msg);
                                       ~^                                      ~~~~~~
                                       %ld
    /home/frank/eclipse-workspace/FreeRTOS_BBB/source/src/application/app_MultiSinkLogger.c:168:14: warning: unused variable ‘rv’ [-Wunused-variable]
         uint32_t rv = pdFAIL;
                  ^~
    /home/frank/eclipse-workspace/FreeRTOS_BBB/source/src/application/app_MultiSinkLogger.c: In function ‘SerialisedLogPrintf’:
    /home/frank/eclipse-workspace/FreeRTOS_BBB/source/src/application/app_MultiSinkLogger.c:216:19: warning: pointer targets in initialization of ‘char *’ from ‘uint8_t *’ {aka ‘unsigned char *’} differ in signedness [-Wpointer-sign]
         char * pMsg = BUFFERPOOL_GetFreeBuffer(&m);
                       ^~~~~~~~~~~~~~~~~~~~~~~~
    /home/frank/eclipse-workspace/FreeRTOS_BBB/source/src/application/app_MultiSinkLogger.c:235:37: warning: pointer targets in passing argument 1 of ‘BUFFERPOOL_ReturnBuffer’ differ in signedness [-Wpointer-sign]
                 BUFFERPOOL_ReturnBuffer(pMsg);
                                         ^~~~
    In file included from /home/frank/eclipse-workspace/FreeRTOS_BBB/source/src/application/app_MultiSinkLogger.c:43:
    /home/frank/eclipse-workspace/FreeRTOS_BBB/source/src/portable/ported_aws_bufpool/inc/aws_bufferpool.h:72:6: note: expected ‘uint8_t * const’ {aka ‘unsigned char * const’} but argument is of type ‘char *’
     void BUFFERPOOL_ReturnBuffer( uint8_t * const pucBuffer );
          ^~~~~~~~~~~~~~~~~~~~~~~
    [  3%] Building C object application/CMakeFiles/src_application.dir/app_utils.c.o
    /home/frank/eclipse-workspace/FreeRTOS_BBB/source/src/application/app_utils.c: In function ‘vAssertCalled’:
    /home/frank/eclipse-workspace/FreeRTOS_BBB/source/src/application/app_utils.c:185:22: warning: unused variable ‘xPrinted’ [-Wunused-variable]
     static portBASE_TYPE xPrinted = pdFALSE;
                          ^~~~~~~~
    /usr/arm-linux-gnueabihf/include/unistd.h: In function ‘_exit’:
    /home/frank/eclipse-workspace/FreeRTOS_BBB/source/src/application/app_utils.c:107:1: warning: ‘noreturn’ function does return
     }
     ^
    At top level:
    /home/frank/eclipse-workspace/FreeRTOS_BBB/source/src/application/app_utils.c:185:22: warning: ‘xPrinted’ defined but not used [-Wunused-variable]
     static portBASE_TYPE xPrinted = pdFALSE;
                          ^~~~~~~~
    [  3%] Building C object application/CMakeFiles/src_application.dir/enet_wrapper.c.o
    /home/frank/eclipse-workspace/FreeRTOS_BBB/source/src/application/enet_wrapper.c: In function ‘InitLwipStack’:
    /home/frank/eclipse-workspace/FreeRTOS_BBB/source/src/application/enet_wrapper.c:279:21: warning: unused variable ‘rv’ [-Wunused-variable]
                 uint8_t rv = PhyReset(CPSW0_MDIO_REGS, ifNum);
                         ^~
    /home/frank/eclipse-workspace/FreeRTOS_BBB/source/src/application/enet_wrapper.c: In function ‘lwip_main’:
    /home/frank/eclipse-workspace/FreeRTOS_BBB/source/src/application/enet_wrapper.c:369:18: warning: unused variable ‘ipAddr’ [-Wunused-variable]
         unsigned int ipAddr;
                      ^~~~~~
    /home/frank/eclipse-workspace/FreeRTOS_BBB/source/src/application/enet_wrapper.c: In function ‘lwIPDHCPComplete’:
    /home/frank/eclipse-workspace/FreeRTOS_BBB/source/src/application/enet_wrapper.c:672:19: warning: assignment to ‘volatile unsigned char *’ from incompatible pointer type ‘void **’ [-Wincompatible-pointer-types]
                 state = &(cpswNetIF[ifNum].state);
                       ^
    At top level:
    /home/frank/eclipse-workspace/FreeRTOS_BBB/source/src/application/enet_wrapper.c:654:13: warning: ‘lwIPDHCPComplete’ defined but not used [-Wunused-function]
     static void lwIPDHCPComplete(unsigned int ifNum)
                 ^~~~~~~~~~~~~~~~
    /home/frank/eclipse-workspace/FreeRTOS_BBB/source/src/application/enet_wrapper.c:618:13: warning: ‘IpAddrDisplay’ defined but not used [-Wunused-function]
     static void IpAddrDisplay(unsigned int ipAddr)
                 ^~~~~~~~~~~~~
    make[2]: Entering directory '/home/frank/eclipse-workspace/FreeRTOS_BBB/build'
    [ 80%] Building C object netif/CMakeFiles/src_portable_lwip_ports_cpsw_netif.dir/cpswif.c.o
    /home/frank/eclipse-workspace/FreeRTOS_BBB/source/src/portable/lwip/ports/cpsw/netif/cpswif.c: In function ‘cpswif_ale_entry_match_free’:
    /home/frank/eclipse-workspace/FreeRTOS_BBB/source/src/portable/lwip/ports/cpsw/netif/cpswif.c:320:51: warning: passing argument 3 of ‘CPSWALETableEntryGet’ from incompatible pointer type [-Wincompatible-pointer-types]
         CPSWALETableEntryGet(cpswinst->ale_base, idx, ale_entry);
                                                       ^~~~~~~~~
    In file included from /home/frank/eclipse-workspace/FreeRTOS_BBB/source/src/portable/lwip/ports/cpsw/netif/cpswif.c:61:
    /home/frank/eclipse-workspace/FreeRTOS_BBB/source/lib/third_party/ti/include/cpsw.h:297:41: note: expected ‘unsigned int *’ but argument is of type ‘u32_t *’ {aka ‘long unsigned int *’}
                               unsigned int *aleEntryPtr);
                               ~~~~~~~~~~~~~~^~~~~~~~~~~
    /home/frank/eclipse-workspace/FreeRTOS_BBB/source/src/portable/lwip/ports/cpsw/netif/cpswif.c: In function ‘cpswif_port_to_host_vlan_cfg’:
    /home/frank/eclipse-workspace/FreeRTOS_BBB/source/src/portable/lwip/ports/cpsw/netif/cpswif.c:371:49: warning: passing argument 3 of ‘CPSWALETableEntrySet’ from incompatible pointer type [-Wincompatible-pointer-types]
       CPSWALETableEntrySet(cpswinst->ale_base, idx, ale_v_entry);
                                                     ^~~~~~~~~~~
    In file included from /home/frank/eclipse-workspace/FreeRTOS_BBB/source/src/portable/lwip/ports/cpsw/netif/cpswif.c:61:
    /home/frank/eclipse-workspace/FreeRTOS_BBB/source/lib/third_party/ti/include/cpsw.h:295:41: note: expected ‘unsigned int *’ but argument is of type ‘u32_t *’ {aka ‘long unsigned int *’}
                               unsigned int *aleEntryPtr);
                               ~~~~~~~~~~~~~~^~~~~~~~~~~
    /home/frank/eclipse-workspace/FreeRTOS_BBB/source/src/portable/lwip/ports/cpsw/netif/cpswif.c:389:49: warning: passing argument 3 of ‘CPSWALETableEntrySet’ from incompatible pointer type [-Wincompatible-pointer-types]
       CPSWALETableEntrySet(cpswinst->ale_base, idx, ale_vu_entry);
                                                     ^~~~~~~~~~~~
    In file included from /home/frank/eclipse-workspace/FreeRTOS_BBB/source/src/portable/lwip/ports/cpsw/netif/cpswif.c:61:
    /home/frank/eclipse-workspace/FreeRTOS_BBB/source/lib/third_party/ti/include/cpsw.h:295:41: note: expected ‘unsigned int *’ but argument is of type ‘u32_t *’ {aka ‘long unsigned int *’}
                               unsigned int *aleEntryPtr);
                               ~~~~~~~~~~~~~~^~~~~~~~~~~
    /home/frank/eclipse-workspace/FreeRTOS_BBB/source/src/portable/lwip/ports/cpsw/netif/cpswif.c: In function ‘cpswif_rx_inthandler’:
    /home/frank/eclipse-workspace/FreeRTOS_BBB/source/src/portable/lwip/ports/cpsw/netif/cpswif.c:2144:8: warning: implicit declaration of function ‘ethernet_input’; did you mean ‘etharp_input’? [-Wimplicit-function-declaration]
         if(ethernet_input((struct pbuf *)pbuf, netif_arr + if_num) != ERR_OK) {
            ^~~~~~~~~~~~~~
            etharp_input

    [ 87%] Building C object ARM_CA8_amm335x/CMakeFiles/src_portable_FreeRTOS_portable_GCC_ARM_CA8_amm335x.dir/port.c.o
 /home/frank/eclipse-workspace/FreeRTOS_BBB/source/src/portable/FreeRTOS/

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...