This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

C++ eclipse compilation

Hi,

I tried to compile my own program with eclipse and GCC with c/c++. I followed this tutorial : TUTORIAL

I have some problems :

  • First : i have problem with SEGGER RTT lib compilation

    SEGGER_RTT_Syscalls_GCC.c:63:21: warning: its scope is only this definition or declaration, which is probably not what you want

    SEGGER_RTT_Syscalls_GCC.c:98:21: warning: 'struct _reent' declared inside parameter list int _write_r(struct _reent *r, int file, char *ptr, int len) { ^

    SEGGER_RTT_Syscalls_GCC.c:98:5: error: conflicting types for '_write_r' int _write_r(struct _reent *r, int file, char *ptr, int len) { ^

    SEGGER_RTT_Syscalls_GCC.c:63:5: note: previous declaration of '_write_r' was here int _write_r(struct _reent *r, int file, char *ptr, int len); ^

    make: *** [src/Segger_RTT/SEGGER_RTT_Syscalls_GCC.o]

et le contenu du fichier syscalls :

#include "SEGGER_RTT.h"


int _write(int file, char *ptr, int len);
int _write_r(struct _reent *r, int file, char *ptr, int len);

int _write(int file, char *ptr, int len) {
  (void) file;  /* Not used, avoid warning */
  SEGGER_RTT_Write(0, ptr, len);
  return len;
}

int _write_r(struct _reent *r, int file, char *ptr, int len) {
  (void) file;  /* Not used, avoid warning */
  (void) r;  /* Not used, avoid warning */
  SEGGER_RTT_Write(0, ptr, len);
  return len;
}
  • Second : i have problem with memory and standard libraries. (like iostream)

when i use standard lib iostream:

c:/gnutoolsarmembedded/5.42016q2/bin/../lib/gcc/arm-none-eabi/5.4.1/../../../../arm-none-eabi/bin/ld.exe: test.elf section .text' will not fit in regionFLASH'

c:/gnutoolsarmembedded/5.42016q2/bin/../lib/gcc/arm-none-eabi/5.4.1/../../../../arm-none-eabi/bin/ld.exe: region `FLASH' overflowed by 156012 bytes

I saw on google, that is a memory space problem. My .hex is too big.

If someone had same problem or solution.

Regards,

Parents
  • Hi,

    RTT files are included in the latest SDK (11.0.0), under (sdk folder)/external/segger_rtt. Some of the SDK examples uses RTT, in particular for logging (nrf_log library). If the RTT files are included in the SDK you are using then I suggest you stick to them rather than fetching a potentially different version from segger.

    When that is said, I do have some vague memories of getting similar errors myself. I do not remember what I did to fix it, but if you enable RTT logging for an SDK example and get that to work you should at least have some idea what a working setup looks like.

    Regarding C++ libraries (or rather, their size) microcontrollers in general have limited program memory and are traditionally programmed in C. This means most lightwight and μc libraries are written in C. Also C++ libraries have not been subject to the same size limitations as have C libraries. Add to this that some string manipulations are complex operations, and you will see why string libraries are so large. I am sure someone would suggest a library if you state what operations you need.

    Regards, Terje

Reply
  • Hi,

    RTT files are included in the latest SDK (11.0.0), under (sdk folder)/external/segger_rtt. Some of the SDK examples uses RTT, in particular for logging (nrf_log library). If the RTT files are included in the SDK you are using then I suggest you stick to them rather than fetching a potentially different version from segger.

    When that is said, I do have some vague memories of getting similar errors myself. I do not remember what I did to fix it, but if you enable RTT logging for an SDK example and get that to work you should at least have some idea what a working setup looks like.

    Regarding C++ libraries (or rather, their size) microcontrollers in general have limited program memory and are traditionally programmed in C. This means most lightwight and μc libraries are written in C. Also C++ libraries have not been subject to the same size limitations as have C libraries. Add to this that some string manipulations are complex operations, and you will see why string libraries are so large. I am sure someone would suggest a library if you state what operations you need.

    Regards, Terje

Children
No Data
Related