MQX 4.1 using EWL (Embedded Warrior Libraries)

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

MQX 4.1 using EWL (Embedded Warrior Libraries)

1,400 Views
jasonss
Contributor III

I am porting an MQX 3.7 ColdFire application to MQX 4.1 and I am having issues building with the EWL libraries, which we are using with the MQX 3.7 application. 

Currently I am simply trying to create a new basic MQX 4.1 project using the project wizard (in CodeWarrior 10.6) with the Librarian model set to “ewl” (int_FP, int_FP, buffered) and I am still getting build errors.  I can change the Librarian model back to “c9x” and all builds fine, however for my application I need the smaller memory footprint advantage of the ewl libraries so I don’t believe c9x will work.  FYI, I found the following thread on the Freescale community forums, however I don’t need to use C++ and the issues described are different than what I am experiencing so they don’t help.

https://community.freescale.com/thread/305191

Here are the steps I follow to reproduce the build error:

  1. In CodeWarrior click File->New->MQX 4.1 Project
  2. Enter a name and select “TWRMCF52259 Board”.
  3. Select application type: “New application”
  4. Do not select any of the additional MQX libraries.
  5. Select application type: “Empty application”
  6. Don’t add any more files to the project and click Finish.
  7. Set “twrmcf52259_Int_Flash_Release” as the active Build Configuration (Note: I have already successfully built release builds of the BSP, PSP, etc)
  8. Clean/Build the project. The project builds successfully.
  9. Under project properties, change the Librarian model from “c9x” to “ewl” (int_FP, int_FP, buffered).
  10. Clean/Build the project.  The build fails with the following error:

---------------------------------------------------------------------------------------------------------------------------------

**** Build of configuration twrmcf52259_Int_Flash_Release for project appl ****

"C:\\Freescale\\CW MCU v10.6\\gnu\\bin\\mingw32-make" -j16 all

'Building file: ../Sources/main.c'

'Executing target #1 ../Sources/main.c'

'Invoking: ColdFire Compiler'

"C:/Freescale/CW MCU v10.6/MCU/ColdFire_Tools/Command_Line_Tools/mwccmcf" @@"Sources/main.args" -o "Sources/main_c.obj" "../Sources/main.c" -MD -gccdep

C:/Freescale/CW MCU v10.6/MCU/ColdFire_Tools/Command_Line_Tools/mwccmcf|Compiler|Error

(C:\Sandbox\New_HIC_MQX_4_1_1\appl\twrmcf52259_Int_Flash_Release\(command-line defines)|1|8|8|8|8)

=#define _EWL_C99 1

>macro '_EWL_C99' redefined

C:/Freescale/CW MCU v10.6/MCU/ColdFire_Tools/Command_Line_Tools/mwccmcf|Compiler|Note

(C:\Freescale\CW MCU v10.6\MCU\ColdFire_Support\ewl\EWL_C\include\lib_ewl.prefix|19|9|8|496|8)

= #define _EWL_C99    0 /* EWL is not C99 compliant  */ 

>    (location of previous definition)

Errors caused tool to abort.

mingw32-make: *** [Sources/main_c.obj] Error 1

---------------------------------------------------------------------------------------------------------------------------------

11. It seems that the lib_ewl.prefix file is not aware that “_EWL_C99” is defined in my project.  I can manually edit the prefix file to add “#define _EWL_C99  1” and I am able to build successfully.  However, this only works with this very basic MQX 4.1 project that I have created.  If I follow the same steps above, but also select “Add Shell support” and “Add RTCS support” … and also select “Basic Application” in the new MQX 4.1 Project wizard, I get the following build errors (assuming I have again edited the lib_ewl.prefix to define _EWL_C99 as 1):

---------------------------------------------------------------------------------------------------------------------------------

'Building target: appl.elf'

'Executing target #4 appl.elf'

'Invoking: ColdFire Linker'

"C:/Freescale/CW MCU v10.6/MCU/ColdFire_Tools/Command_Line_Tools/mwldmcf" -o "appl.elf" @@"appl.args" 

C:/Freescale/CW MCU v10.6/MCU/ColdFire_Tools/Command_Line_Tools/mwldmcf|Linker|Error

>Undefined : "__ctype_mapC"

>Referenced from "isdigit" in

C:/Freescale/CW MCU v10.6/MCU/ColdFire_Tools/Command_Line_Tools/mwldmcf|Linker|Error

>Undefined : "__ctype_mapC"

>Referenced from "isupper" in

C:/Freescale/CW MCU v10.6/MCU/ColdFire_Tools/Command_Line_Tools/mwldmcf|Linker|Error

>Undefined : "__ctype_mapC"

>Referenced from "isxdigit" in

C:/Freescale/CW MCU v10.6/MCU/ColdFire_Tools/Command_Line_Tools/mwldmcf|Linker|Error

>Undefined : "__lower_mapC"

>Referenced from "tolower" in

C:/Freescale/CW MCU v10.6/MCU/ColdFire_Tools/Command_Line_Tools/mwldmcf|Linker|Error

>Link failed.

Errors caused tool to abort.

mingw32-make: *** [appl.elf] Error 1

---------------------------------------------------------------------------------------------------------------------------------

I have not been able to get past these build errors. I have even tried unchecking the “Enable automatic library configurations” under the Librarian options and manually adding the libc.a and librt.a from the “C:\Freescale\CW MCU v10.6\MCU\ColdFire_Support\ewl\lib\v2” directory and I get basically the same build errors.  FYI, here are the Compiler Preprocessor defines that I am using (which are the defaults when creating a new MQX 4.1 project):

_EWL_C99=1

_EMBEDDED_WARRIOR_CTYPE=0

_EWL_FLOATING_POINT=1

__CODEWARRIOR__=1

0 Kudos
2 Replies

484 Views
Carlos_Musich
NXP Employee
NXP Employee

Hi Jason,

I have investigated with the CW development team and they provided the following comments and solution.

-          MQX is written heavily using some of the C99 features

-          disabling C99 will require small changes in the MQX libraries and in the MQX libraries building options (resulting in the need to rebuild them)

-          using EWL in the ‘new project’ will also require some changes in the project default options

-          you also need to ignore LOTS of warnings (most of them emitted due to C99 disabling)

If you are willing to do these changes, here they are:


-          remove the “_EWL_C99=1” and “_EMBEDDED_WARRIOR_CTYPE=1” from the ‘Project -> Properties -> C/C++ Build -> Settings -> ColdFire Compiler -> Preprocessor -> Defined Macros (-D)’ from all library projects (or if you’re using a makefile build, remove the ‘-D’ options involving the two macros)

-          add in a MQX header file (which would eventually be included from everywhere – for instance ‘mqx_cnfg.h’ or even ‘mqx.h’ – I used ‘mqx_cnfg.h’) the following sequence:

#if _EWL_C99==0

typedef int bool;

const int false = 0;

const int true = 1;

#endif

-          rebuild all libraries that you need in your project

-          in the project you created with ‘New MQX Project Wizard’ you also need to remove the “_EWL_C99=1” and “_EMBEDDED_WARRIOR_CTYPE=1”

-          chose in the new project the ‘EWL’ Librarian you find appropriate for your project

-          after these steps the project should build correctly

Best regards,

Carlos Musich

Technical Support Engineer

0 Kudos

484 Views
Carlos_Musich
NXP Employee
NXP Employee

Hi Jason,

The MQX version 4.1.0 adopted the standard C99 integer and boolean types (from stdlib.h and stdbool.h) instead of the proprietary MQX types. So When porting the application to the MQX version 4.1.0, you have to use the C9x library for any new projects. That is why the new 4.1 wizard set c9x as the default library.

Best regards,

Carlos Musich

Technical Support Engineer

0 Kudos