Problem regarding embOS and C++

This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

  • Problem regarding embOS and C++

    Hi,

    we used embOS 3.32a in former projects some years ago. In a current project we use the same processor (Atmel AT91SAM7A3) we did in the mentioned project years ago.

    Since it is a small project we wanted to reuse some of the existing parts and the OS. We took some old code(C) and wrote new C++ code. Everything worked well until our final hardware arrived and we wanted to test the application running out of flash memory. The application didn't start. After some research and investigation we found the problem which occurs even in the sample application (LED toggle) shipped with the OS. We are using IAR Embedded Workbench 4.40A. If we compile the sample project with one of the c++ compiler settings (embedded c++/extended embedded cpp) it runs right after downloading thru the j-link debugger. The problem occurs when we power don/reset the board. The application doesn't start out of flash after a power up/reset. If we compile it using the c compiler it starts without any problem, right after downloading and after power up as well.

    Are there any know issues with these (old) versions or settings which have to be applied?

    Best

    Marcel
  • Hello,

    I just tested it and noticed that there is an issue with the prototype of __low_level_init(). The prototype is not correct for C++.
    In that case the linker will not include our __low_level_init() function and the PLL and the watchdog is not intialized.
    If you use the C-Spy debugger the macro file initializes PLL und watchdog. Therefore it runs with C-Spy debugger but not
    standalone.

    Please replace the prototype in __low_level_init.c with the following one.

    C Source Code

    1. #ifdef __cplusplus
    2. extern "C" {
    3. #endif
    4. __interwork int __low_level_init(void); // Avoid "no prototype" warning
    5. #ifdef __cplusplus
    6. }
    7. #endif


    If you like please contact us directly so I am able to send you the updated __low_level_init.c.

    Best regards,
    Til
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: segger.com/ticket/

    Or you can contact us via e-mail.