std::vector in S32 & EWL

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

std::vector in S32 & EWL

1,890 Views
fab1
Contributor II

I have a strange problem. As soon as I start using a std::vector, I get a link error.

The following code is a simple S32 C++/EWL project:

#include <vector>

int main()
{
     counterclass myccounter;

    xcptn_xmpl ();              /* Configure and Enable Interrupts */

    std::vector<int> a;
    a.push_back(10);

    /* Loop forever */
     for(;;) {     
               myccounter.increment();
          }
}
‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

It is the main generated by the S32 wizard (I am not even setting the C++ dialect). If I try to compile this code I get the following error:

Building target: cpp_stl_Z7_0.elf
Executing target #8 cpp_stl_Z7_0.elf
Invoking: Standard S32DS C++ Linker
powerpc-eabivle-g++ -o "cpp_stl_Z7_0.elf" "@cpp_stl_Z7_0.args"    
./src/main.o: In function `std::tr1::detail::shared_ptr_deleter<char, std::detail::default_delete<char []>, std::allocator<void> >::get_deleter(std::type_info const&) const':
/home/fab/Applications/NXP/S32DS_Power_v2017.R1/S32DS/e200_ewl2/EWL_C++/include/ewl_smart_pointers:1322: undefined reference to `std::type_info::operator==(std::type_info const&) const'
makefile:70: recipe for target 'cpp_stl_Z7_0.elf' failed
collect2: error: ld returned 1 exit status
make: *** [cpp_stl_Z7_0.elf] Error 1

Am I forgetting a library setting somewhere?

thanks!

Labels (1)
Tags (3)
6 Replies

1,433 Views
fab1
Contributor II

Unfortunately yes, I tried with both C++98 and C++11. The error is the same in all cases.

0 Kudos

1,433 Views
b48014
NXP Employee
NXP Employee

Hi Fabrizio,

Could you try to set _EWL_NO_RTTI define in the project settings?

pastedImage_2.png

PS: But i suggest you to use the newlib instead of ewl:

pastedImage_1.png

Best regards,

Dmitry

0 Kudos

1,433 Views
fab1
Contributor II

Hi Dmitry,

Thank you! That solved the problem in the little example I had.

I would gladly switch to Newlib if I could solve the UART problem. Our application uses the UART to exchange data with a PC. If I compile with Newlib enabled (any of the variations), I get the following error:

make -j8 all
Building file: ../src/hardware/board_axiom.cpp
Building file: ../src/hardware/uart/uart.c
Building file: ../src/hardware/uart/uart_console_io.c
Executing target #3 ../src/hardware/board_axiom.cpp
Executing target #12 ../src/hardware/uart/uart.c
Executing target #13 ../src/hardware/uart/uart_console_io.c
Invoking: Standard S32DS C Compiler
Invoking: Standard S32DS C++ Compiler
powerpc-eabivle-gcc "@src/hardware/uart/uart.args" -MMD -MP -MF"src/hardware/uart/uart.d" -MT"src/hardware/uart/uart.o" -c -o "src/hardware/uart/uart.o" "../src/hardware/uart/uart.c"
powerpc-eabivle-g++ "@src/hardware/board_axiom.args" -MMD -MP -MF"src/hardware/board_axiom.d" -MT"src/hardware/board_axiom.o" -c -o "src/hardware/board_axiom.o" "../src/hardware/board_axiom.cpp"
Invoking: Standard S32DS C Compiler
powerpc-eabivle-gcc "@src/hardware/uart/uart_console_io.args" -MMD -MP -MF"src/hardware/uart/uart_console_io.d" -MT"src/hardware/uart/uart_console_io.o" -c -o "src/hardware/uart/uart_console_io.o" "../src/hardware/uart/uart_console_io.c"
../src/hardware/uart/uart_console_io.c:22:0: warning: ignoring #pragma ANSI_strict off [-Wunknown-pragmas]
 #pragma ANSI_strict off /* _No_Console will be empty file */
 ^
src/hardware/uart/subdir.mk:47: recipe for target 'src/hardware/uart/uart_console_io.o' failed
../src/hardware/uart/uart_console_io.c:24:24: fatal error: ansi_parms.h: No such file or directory
 #include <ansi_parms.h>
                        ^
compilation terminated.
make: *** [src/hardware/uart/uart_console_io.o] Error 1
make: *** Waiting for unfinished jobs....
../src/hardware/uart/uart.c: In function 'InitializeUART':
../src/hardware/uart/uart.c:175:0: warning: ignoring #pragma unused  [-Wunknown-pragmas]
 #pragma unused(baudRate)
 ^
Finished building: ../src/hardware/uart/uart.c
 
Finished building: ../src/hardware/board_axiom.cpp

I know that "uart_console_io.h" from the EWL library. So, that's probably not correct. Do you happen to know if there is a substitute for that file in Newlib?

0 Kudos

1,433 Views
b48014
NXP Employee
NXP Employee

Hi Fabrizio,

As far as I can see, uart_console_io.c  is used to support MetroTRK UART library interface. I don't think that there's any substitute for that file in Newlib. So use EWL library and _EWL_NO_RTTI define, if you really want to use this MetroTRK support

Best regards,

Dmitry

0 Kudos

1,433 Views
fab1
Contributor II

Thank for your help Dmitry! It was very much appreciated. I devised a workaround for this problem that solves all my problems.

However, now I have another problem with a DMA setup for the UART on the 5676R. I have just posted the question.

0 Kudos

1,433 Views
jiri_kral
NXP Employee
NXP Employee

Hi, 

did you set the C++ dialect to C++11 in project properties/settings?

pastedImage_3.png

Jiri 

0 Kudos