I'm trying to call functions in C standard library, e.g. printf(...). I created a new S32DS project with Newlib setting, but got some error when linking:
/home/rb501c/build_gcc_dir/build_gnu/opt/freescale/ELvle/obj_newlib/powerpc-eabivle/fp/e200z4/libgloss/libnosys/../../../../../../src_newlib/libgloss/libnosys/sbrk.c:21: undefined reference to `end'
/home/rb501c/build_gcc_dir/build_gnu/opt/freescale/ELvle/obj_newlib/powerpc-eabivle/fp/e200z4/libgloss/libnosys/../../../../../../src_newlib/libgloss/libnosys/sbrk.c:21: undefined reference to `end'
collect2.exe: error: ld returned 1 exit status
make: *** [HwTest2.elf] Error 1
I also tried to call another function sleep(1) but indicated that it's undefined. I included <sys/unitstd.h>.
If anybody have any idea about newlib configuration for libc.a?
Thanks Martin.
I had linking issues when assert() was used. It used printf() internally. This discussion thread really helped me. I used your uart_console_io.c and modified my UART functions as needed.
Hi,
I have also written simple document about EWL and printf function. You can check:
https://community.nxp.com/docs/DOC-332018
Regards,
Martin
Hi Martin I am not printf output on UART.
I am running micrium rtos on mpc 574xg MB board with mpc5748-176ds and I am calling printf from my application with all changes made according to u r suggestions.
I got one doubt how printf func will call read_console, write_console functions in UART_console_io.c
Hi,
please let's solve this issue in single thread. I suggest the following thread which also alexvinchev helps us in.
Regards,
Martin
Hi Martin,
The Application was crashed while running .I dont know how to configure SIUL and LINFLEX modules correct in uart.c file(MPC5748G).Can you please help me out.
what about the pformatterfp, where it is defined.
Hi,
look at the following thread. https://community.freescale.com/message/651904?et=watches.email.thread#comment-651904
alexvinchev post there answer you are looking for.
Regards,
Martin
Hi Martin I am not getting printf output on UART.
I am running micrium rtos on mpc 574xg MB board with mpc5748-176ds and I am calling printf from my application with all changes made according to u r suggestions.
I got one doubt how printf func will call read_console, write_console functions in UART_console_io.c
Thank you very much Mr. Martin ,
I used your link MPC5748G error when building for solving above query. I added the files(uart.c,uart.h and uart_console_io.c for mpc5748) to my project.I am able to compile successfully.
Regards,
Thank you Martin,One more thing I want bring to u r notice that you may help.We are working with MPC5748G Microcontroller.
So I included that header file which i have already,I couldn't find Configuration of SICL &LINFLEX in uart.c file.b55689
It is compiling but one more error is getting ,Can you please help me how to sort out the following error
C:/Freescale/S32_Power_v1.0/S32DS/e200_ewl2/lib/fp/e200z4\libc.a(printf.o): In function `printf':
S32DS/e200_ewl/EWL_C/src/stdio/printf.c:44: undefined reference to `__pformatter'
collect2.exe: error: ld returned 1 exit status
scons: *** [DEBUG\BG_Z4_1.elf] Error 1
scons: building terminated because of errors.
@Hi Martin ,
Thank you for early reply,I added the file but I got the below errors after compiling
app\uart_console_io.o: In function `__read_console':
C:\Users\yalamanda\Downloads\bg\BCG_OS3_Z4_1\ecu/app/uart_console_io.c:93: undefined reference to `ReadUARTN'
app\uart_console_io.o: In function `__write_console':
C:\Users\yalamanda\Downloads\bg\BCG_OS3_Z4_1\ecu/app/uart_console_io.c:151: undefined reference to `WriteUARTN'
app\uart_console_io.o: In function `__init_uart_console':
C:\Users\yalamanda\Downloads\bg\BCG_OS3_Z4_1\ecu/app/uart_console_io.c:200: undefined reference to `InitializeUART'
C:/Freescale/S32_Power_v1.0/S32DS/e200_ewl2/lib/fp/e200z4\libc.a(printf.o): In function `printf':
S32DS/e200_ewl/EWL_C/src/stdio/printf.c:44: undefined reference to `__pformatter'
collect2.exe: error: ld returned 1 exit status
scons: *** [DEBUG\BG_Z4_1.elf] Error 1
scons: building terminated because of errors.
Hi All,
I am also facing similar problem .Plz look at the below ,Plz help me how to overcome this as early as possible.b55689
C:/Freescale/S32_Power_v1.0/S32DS/e200_ewl2/lib/fp/e200z4\libc.a(printf.o): In function `printf':
S32DS/e200_ewl/EWL_C/src/stdio/printf.c:44: undefined reference to `__pformatter'
C:/Freescale/S32_Power_v1.0/S32DS/e200_ewl2/lib/fp/e200z4\libc.a(ansi_files.o):(.data.__files+0x38): undefined reference
to `__read_console'
C:/Freescale/S32_Power_v1.0/S32DS/e200_ewl2/lib/fp/e200z4\libc.a(ansi_files.o):(.data.__files+0x3c): undefined reference
to `__write_console'
C:/Freescale/S32_Power_v1.0/S32DS/e200_ewl2/lib/fp/e200z4\libc.a(ansi_files.o):(.data.__files+0x40): undefined reference
to `__close_console'
C:/Freescale/S32_Power_v1.0/S32DS/e200_ewl2/lib/fp/e200z4\libc.a(ansi_files.o):(.data.__files+0x7c): undefined reference
to `__read_console'
C:/Freescale/S32_Power_v1.0/S32DS/e200_ewl2/lib/fp/e200z4\libc.a(ansi_files.o):(.data.__files+0x80): undefined reference
to `__write_console'
C:/Freescale/S32_Power_v1.0/S32DS/e200_ewl2/lib/fp/e200z4\libc.a(ansi_files.o):(.data.__files+0x84): undefined reference
to `__close_console'
C:/Freescale/S32_Power_v1.0/S32DS/e200_ewl2/lib/fp/e200z4\libc.a(ansi_files.o):(.data.__files+0xc0): undefined reference
to `__read_console'
C:/Freescale/S32_Power_v1.0/S32DS/e200_ewl2/lib/fp/e200z4\libc.a(ansi_files.o):(.data.__files+0xc4): undefined reference
to `__write_console'
C:/Freescale/S32_Power_v1.0/S32DS/e200_ewl2/lib/fp/e200z4\libc.a(ansi_files.o):(.data.__files+0xc8): undefined reference
to `__close_console'
collect2.exe: error: ld returned 1 exit status
scons: *** [DEBUG\BG_Z4_1.elf] Error 1
scons: building terminated because of errors.
It's PowerPC architecture, Panther MPC5744p from NXP.
I also found memcpy in string.h can be called. There is no any linking error. So I guess function sleep() is not implemented in Newlib C library? If yes, which function should we call to let task go to sleep in Newlib?
Hi,
look at the following example and add files uart.c, uart.h and uart_console_io.c. Then edit section.ld file. Stack section should looks as follows:
.stack (NOLOAD) : ALIGN(16)
{
__HEAP = . ;
_end = . ;
end = . ;
. += __HEAP_SIZE ;
__HEAP_END = . ;
_stack_end = . ;
. += __STACK_SIZE ;
_stack_addr = . ;
__SP_INIT = . ;
. += 4;
} > m_data
Do not forget #include <stdio.h>
Example MPC5744P PinToggleStationery S32DS
About sleep function, it is not implemented. I do not think there is function, which allows you to sleep task. If you do not use operating system, there is nothing like task. But you can use for example FOR loop instead of this function or look at the Mode Entry module. This module is able to switch micro to STOP mode or HALT mode.
Regards,
Martin
Hi,
could you please clarify, if you use S32 Design Studio for ARM of for Power Architecture? And which processor you use?
Regards,
Martin