Please Check Your License

The good thing with many vendors is: they offer development tools free of charge. And the limitations are typically reasonable for many projects. The Eclipse based CodeWarrior for MCU10 is not an exception: it comes in a free (‘Special’) Edition which allows up to 128 KByte of code to download for my ARM/Kinetis projects.

But, when I tried to debug an Example I have downloaded from the web, I get this dialog:

“Download size limit has been exceeded. Please check your license.”

Download Size Limit Has Been Exceeded

Download Size Limit Has Been Exceeded

Obviously I’m running beyond the limits. But what is my code size?  To find out, I enable link map generation in the build tool settings:

Generate Link Map

Generate Link Map

At the bottom of the linker map I find the code size information:

  # Memory map:
  v_addr   p_addr   size     name
  00000000 00000000 000001E0 .interrupts m_interrupts
  00000800 00000800 00007F48 .app_text  m_text
  20000000 20000000 00000000 .usb_bdt_sec m_bdt
  1FFF0000 00008748 00000D68 .app_data  m_data
  1FFF0D68 1FFF0D68 000003E8 .bss       m_data
  1FFF1150 000094B0 00000018 .romp      m_data
  00000400 00000400 00000000 .cfmprotect m_cfmprotrom

m_text with 0x7F48 is way below 128 KByte.  Checking the brochure shows “C: 128K” for Kinetis and Special Edition:

Special Edition Limits (Source: CWMCU10.2_BR.pdf, Freescale)

Special Edition Limits (Source: CWMCU10.2_BR.pdf, Freescale)

Oh! it says ‘C‘! Could it be that I have C++ in that example project? I have not seen any C++ files. Maybe the linker map file helps here again?

And indeed, having a look in the linker map file shows usage of C++ functions. For this I searched for “cxx” and “cpp”:

  000069A0 00000000 .text   $t    (librt_Thumb_LE_v7M.a cxxabi_rtti.o  )
  000069B0 00000016 .text   __cxxabiv1::__pointer_type_info::~__pointer_type_info[virtual]()    (librt_Thumb_LE_v7M.a cxxabi_rtti.o  )
  000069B0 00000000 .text   $t    (librt_Thumb_LE_v7M.a cxxabi_rtti.o  )
  000069C8 00000004 .text   __ARM_resolve_target2(void*)    (librt_Thumb_LE_v7M.a cppsemantics.o )
...
  00008728 00000000 .rodata .rodata    (librt_Thumb_LE_v7M.a cppsemantics.o )
  00008728 0000000C .rodata __ARM::is_foreign_exception(_Unwind_Control_Block*)::is_foreign_exception_static    (librt_Thumb_LE_v7M.a cppsemantics.o )
  00008734 00000014 .rodata virtual table for std::bad_exception    (librt_Thumb_LE_v7M.a cppsemantics.o )

But: I do not remember using C++? Looking at the names, it is clear that this is something from the libraries, and has to do with exception handling. Well, this gives a hint, as there is an option to enable exception handling in the compiler. And indeed, that project had that option enabled (not sure why?).

So the solution is to disable the ‘Enable Exceptions’ in the compiler settings:

'Enable Exceptions' turned off

‘Enable Exceptions’ turned off

Now the debugger does not complain any more, and I am able to debug my (purely C) application. And as a positive side effect: the code size changed from 0x7F48 to 0x6084 (more than 7 KByte less code!) 🙂

Summary

If I run into a Special Edition code limit, it might be that the application contains C++ code. It is a good idea to check if the compiler has ‘Enable Exceptions’ set in the build options. Disabling that option not only prevents including C++ library code, but as well makes the application file much smaller.

Happy Special Edition Debugging 🙂

21 thoughts on “Please Check Your License

      • Hello, I am using Freedom Board KL25 and GCC.
        I tryed to copy here the print screen, but i couldnt so i sent to your email. =D

        It this a little bit different, so i didnt find my code size

        Like

        • Hi Maurizio,
          ok, makes sense. The oritinal post was about the Freescale proprietary compiler. The ARM gcc for KL25Z is little bit different. But if this dialog comes up (in the free special edition) it means that a) you are beyond 64 KByte Code size for Kinetis-L or b) you have C++ code in your application. Have a look at the library settings if this is the case.
          I hope this helps.

          Like

  1. Hi Eric!
    I am writing application with freescale mqx rtos, build with GCC(yagarto). I am using PE Micro connect to target (TWRK60N512). I get the same error. Could you help me!
    Sorrry for my bad english.

    Like

  2. Hi Eric.
    I’m writting an app for the TWRK60N512 on Eclipse 10.5 and compiling it with gcc. I reach a point where my .elf file exceded 64KB (right click on my_app.elf file, then propierties, then resources) and when I try to “Run as” it cant be downloaded to the board and gives me the same error you describe. I believe that for Kinetis-K family the maxium size is 128KB. Do you know how can I fix this? Thank you.

    Like

    • Hi Sazza,
      with right click > properties you get the file size on disk, and this is not what counts. What counts is the *code* size of the application. I can downlad/debug Kinetis K projects up to the free 128 KByte.
      Have a look at this post how to see the actual code size:
      https://mcuoneclipse.com/2013/04/14/text-data-and-bss-code-and-data-size-explained/
      If you have less then 128 KByte ‘text’, then you must have some C++ stuff in your code as explained in this post.
      I hope this helps.

      Like

      • Eric, thank you for your answer, I have one more question. As I said before I’m using GCC, do you know how can I disable Exceptions? I cant find this option as you describe in this article.

        Like

        • Hi Sazza,
          It does not have to be caused by exceptions, it could be by any C++ code you have in your application. Are you using any C++ modules or maybe libraries which include C++ code? Maybe you could look at the map file to spot something which is causing this?

          Like

      • Erich, the problem was that my code size was much bigger than 128KB. As you explain in the link you gave me, when I compile the project, my “text” field was 0x2836c=164716 bytes. I’m a bit disappointed because I’m only using MQX + USB HOST + SD CARS and I was hoping that 128Kb was going to be enough. I just submit to a Eval version of CodeWarrior 10.5 Basic Edition. Thank for your help.

        Like

  3. Hi,
    I have the same problem with my CodeWarrior but my hex file have only ~6KB. Any suggestion?

    **** Build of configuration FLASH for project nn ****

    “C:\\Freescale\\CW MCU v10.5\\gnu\\bin\\mingw32-make” -j6 all
    ‘Building file: ../Sources/main.cpp’
    ‘Building file: ../Sources/sa_mtb.c’
    ‘Building file: ../Project_Settings/Startup_Code/__arm_end.c’
    ‘Building file: ../Project_Settings/Startup_Code/__arm_start.c’
    ‘Building file: ../Project_Settings/Startup_Code/kinetis_sysinit.c’
    ‘Executing target #1 ../Sources/main.cpp’
    ‘Executing target #2 ../Sources/sa_mtb.c’
    ‘Executing target #3 ../Project_Settings/Startup_Code/__arm_end.c’
    ‘Executing target #4 ../Project_Settings/Startup_Code/__arm_start.c’
    ‘Executing target #5 ../Project_Settings/Startup_Code/kinetis_sysinit.c’
    ‘Invoking: ARM Ltd Windows GCC C++ Compiler’
    ‘Invoking: ARM Ltd Windows GCC C++ Compiler’
    ‘Invoking: ARM Ltd Windows GCC C++ Compiler’
    “C:/Freescale/CW MCU v10.5/Cross_Tools/arm-none-eabi-gcc-4_7_3/bin/arm-none-eabi-g++” “../Sources/main.cpp” @”Sources/main.args” -MMD -MP -MF”Sources/main.d” -o”Sources/main.o”
    ‘Invoking: ARM Ltd Windows GCC C++ Compiler’
    “C:/Freescale/CW MCU v10.5/Cross_Tools/arm-none-eabi-gcc-4_7_3/bin/arm-none-eabi-g++” “../Sources/sa_mtb.c” @”Sources/sa_mtb.args” -MMD -MP -MF”Sources/sa_mtb.d” -o”Sources/sa_mtb.o”
    ‘Invoking: ARM Ltd Windows GCC C++ Compiler’
    “C:/Freescale/CW MCU v10.5/Cross_Tools/arm-none-eabi-gcc-4_7_3/bin/arm-none-eabi-g++” “../Project_Settings/Startup_Code/__arm_end.c” @”Project_Settings/Startup_Code/__arm_end.args” -MMD -MP -MF”Project_Settings/Startup_Code/__arm_end.d” -o”Project_Settings/Startup_Code/__arm_end.o”
    “C:/Freescale/CW MCU v10.5/Cross_Tools/arm-none-eabi-gcc-4_7_3/bin/arm-none-eabi-g++” “../Project_Settings/Startup_Code/__arm_start.c” @”Project_Settings/Startup_Code/__arm_start.args” -MMD -MP -MF”Project_Settings/Startup_Code/__arm_start.d” -o”Project_Settings/Startup_Code/__arm_start.o”
    “C:/Freescale/CW MCU v10.5/Cross_Tools/arm-none-eabi-gcc-4_7_3/bin/arm-none-eabi-g++” “../Project_Settings/Startup_Code/kinetis_sysinit.c” @”Project_Settings/Startup_Code/kinetis_sysinit.args” -MMD -MP -MF”Project_Settings/Startup_Code/kinetis_sysinit.d” -o”Project_Settings/Startup_Code/kinetis_sysinit.o”
    ‘Finished building: ../Project_Settings/Startup_Code/__arm_end.c’
    ‘Finished building: ../Sources/sa_mtb.c’
    ‘Finished building: ../Project_Settings/Startup_Code/__arm_start.c’
    ‘ ‘
    ‘ ‘
    ‘ ‘
    ‘Finished building: ../Sources/main.cpp’
    ‘ ‘
    ‘Finished building: ../Project_Settings/Startup_Code/kinetis_sysinit.c’
    ‘ ‘
    ‘Building target: nn.elf’
    ‘Executing target #6 nn.elf’
    ‘Invoking: ARM Ltd Windows GCC C++ Linker’
    “C:/Freescale/CW MCU v10.5/Cross_Tools/arm-none-eabi-gcc-4_7_3/bin/arm-none-eabi-g++” @”nn.args” -o”nn.elf”
    ‘Finished building target: nn.elf’
    ‘ ‘
    ‘Executing target #7 nn.hex’
    ‘Executing target #8 nn.siz’
    ‘Invoking: ARM Ltd Windows GNU Create Flash Image’
    ‘Invoking: ARM Ltd Windows GNU Print Size’
    “C:/Freescale/CW MCU v10.5/Cross_Tools/arm-none-eabi-gcc-4_7_3/bin/arm-none-eabi-objcopy” -O ihex nn.elf “nn.hex”
    “C:/Freescale/CW MCU v10.5/Cross_Tools/arm-none-eabi-gcc-4_7_3/bin/arm-none-eabi-size” –format=berkeley nn.elf
    text data bss dec hex filename
    5320 24 540 5884 16fc nn.elf
    ‘Finished building: nn.siz’
    ‘Finished building: nn.hex’
    ‘ ‘
    ‘ ‘

    Like

What do you think?

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.