I generated a project for the 56F8037 with the CW 10.7 "New MCU Project" tool. It does NOT have an OS.
The generated project had support for console output with the following:
/* here we test the thinner console print */
/* printf is too large for MC56F8037 */
//#include "console.h"
//__ConsoleWrite(0,test_string,6);
//fflush_console();
I don't need the console (and it is too slow) so, I commented out those lines. However, I still see the following in the .xMap file:
000004B4 00000080 .bss Fstderr_buff (MSL C 56800E smm.lib ansi_files.o )
00000534 00000080 .bss Fstdout_buff (MSL C 56800E smm.lib ansi_files.o )
000005B4 00000080 .bss Fstdin_buff (MSL C 56800E smm.lib ansi_files.o )
00000634 00000001 .bss Ferrno (MSL C 56800E smm.lib errno.o )
00000635 00000001 .bss F__dbg_io_ready (MSL C 56800E smm.lib hostio.o )
00000636 00000001 .bss FtxtbinFlag (MSL C 56800E smm.lib hostio.o )
For example, stderr_buff is located at:
C:\Freescale\CW MCU v10.7\MCU\M56800E Support\msl\MSL_C\MSL_Common\Include\ansi_files.h
C:\Freescale\CW MCU v10.7\MCU\M56800E Support\msl\MSL_C\MSL_Common\Src\ansi_files.c
ansi_files.h is used in:
C:\Freescale\CW MCU v10.7\MCU\M56800E Support\msl\MSL_C\MSL_Common\Include\file_io.h
C:\Freescale\CW MCU v10.7\MCU\M56800E Support\msl\MSL_C\MSL_Common\Src\ansi_files.c
C:\Freescale\CW MCU v10.7\MCU\M56800E Support\msl\MSL_C\MSL_Common\Src\char_io.c
C:\Freescale\CW MCU v10.7\MCU\M56800E Support\msl\MSL_C\MSL_Common\Src\direct_io.c
C:\Freescale\CW MCU v10.7\MCU\M56800E Support\msl\MSL_C\MSL_Common\Src\file_io.c
C:\Freescale\CW MCU v10.7\MCU\M56800E Support\msl\MSL_C\MSL_Common\Src\file_pos.c
C:\Freescale\CW MCU v10.7\MCU\M56800E Support\msl\MSL_C\MSL_Common\Src\misc_io.c
C:\Freescale\CW MCU v10.7\MCU\M56800E Support\msl\MSL_C\MSL_Common\Src\wchar_io.c
C:\Freescale\CW MCU v10.7\MCU\M56800E Support\msl\MSL_C\MSL_Common\Src\wfile_io.c
How can I get rid of these buffers?
Fstderr_buff
Fstdout_buff
Fstdin_buff
These are using precious RAM that I need to recover.
Regards...
I looked at MSL C Reference Version 10, pages 20 & 21, under the paragraph "Configuring Console I/O". Here is an excerpt:
Console I/O for stdin, stdout, and stderr can be configured in many different ways. The easiest way to configure console I/O is to have it turned off completely. When _MSL_CONSOLE_SUPPORT is off, MSL does not know about stdin, stdout, or stderr. Calls such as printf() are not placed in the standard C library
Grepping through the MSL, the only place that _MSL_CONSOLE_SUPPORT is defined is in
"C:\Freescale\CW MCU v10.7\MCU\M56800E Support\msl\MSL_C\MSL_Common\Include\ansi_parms.h".
Here is the pertinent code:
#if defined(_No_Console) && !defined(_MSL_CONSOLE_SUPPORT)
#define _MSL_CONSOLE_SUPPORT 0
#endif
#ifndef _MSL_CONSOLE_SUPPORT
#define _MSL_CONSOLE_SUPPORT 1
#endif
So, it looks like the documentation is a little behind because now the code keys off of "_No_Console" to disable the console.
Here is some history I found in the MSL comments:
C:\Freescale\CW MCU v10.7\MCU\M56800E Support\msl\MSL_C\MSL_Common\Include\console_io.h
/* Change record:
* ad 990128 Added #ifndef _No_Console */
C:\Freescale\CW MCU v10.7\MCU\M56800E Support\msl\MSL_C\MSL_Common\Src\assert.c
/* Change record:
* cc 020219 Redid the check for _No_Disk_File_OS_Support & _No_Console */
C:\Freescale\CW MCU v10.7\MCU\M56800E Support\msl\MSL_C\MSL_Common\Src\ansi_files.c
/* Change record:
* mm 980509 Removed static attribute so that it can be linked without error when _No_Console
* is defined. MW07076 */
C:\Freescale\CW MCU v10.7\MCU\M56800E Support\msl\MSL_C\MSL_Common_Embedded\Src\uart_console_io.c
#pragma ANSI_strict off /* _No_Console will be empty file */
So, I set _No_Console to 1 in the pre-defined symbols of the project properties and recompiled the libraries. Then I rebuilt my application. Unfortunately, the stdxxx_ buffers are still there.
stderr_buff (MSL C 56800E smm.lib ansi_files.o )
stdout_buff (MSL C 56800E smm.lib ansi_files.o )
stdin_buff (MSL C 56800E smm.lib ansi_files.o )
So, I'm still stuck.
How do I get the compiler to suppress generation of these buffers?
Regards...
Hi,
Can you please create a demo project and upload it here?
I will check it directly on it. Thanks for your cooperation.
Have a great day,
Jennie Zhang
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------