Why can't I convert an executable project to a static library in MCUXpresso?

cancel
Showing results for 
Search instead for 
Did you mean: 

Why can't I convert an executable project to a static library in MCUXpresso?

Jump to solution
726 Views
bmcdonnell_ionx
Contributor III

Question is in the title.

I don't see any way to change it in the project options. Would I really have to generate a new project from scratch? Why?

My current use case is that I've exported mbed-os as an MCUXpresso project, and I want to make it a static library. AFAIK, there is no option to export it as a static library project.

mcuxpresso_exe_proj.png

mcuxpresso_lib_proj.png

When I set it to a Shared Library artifact type, it tries to link everything into a single image, so I don't think that's a workable solution:

Building target: mbed-os.axf
Invoking: MCU C++ Linker
arm-none-eabi-c++ -o "mbed-os.axf" ./targets/TARGET_NXP/TARGET_LPC408X/device/TOOLCHAIN_GCC_ARM/startup_LPC408x.o ./targets/TARGET_NXP/TARGET_LPC408X/device/system_LPC407x_8x_177x_8x.o ./targets/TARGET_NXP/TARGET_LPC408X/TARGET_LPC4088/analogin_api.o ./targets/TARGET_NXP/TARGET_LPC408X/TARGET_LPC4088/can_api.o ./targets/TARGET_NXP/TARGET_LPC408X/TARGET_LPC4088/ethernet_api.o ./targets/TARGET_NXP/TARGET_LPC408X/TARGET_LPC4088/i2c_api.o ./targets/TARGET_NXP/TARGET_LPC408X/TARGET_LPC4088/pwmout_api.o ./targets/TARGET_NXP/TARGET_LPC408X/TARGET_LPC4088/serial_api.o ./targets/TARGET_NXP/TARGET_LPC408X/TARGET_LPC4088/spi_api.o ./targets/TARGET_NXP/TARGET_LPC408X/analogout_api.o ./targets/TARGET_NXP/TARGET_LPC408X/gpio_api.o ./targets/TARGET_NXP/TARGET_LPC408X/gpio_irq_api.o ./targets/TARGET_NXP/TARGET_LPC408X/pinmap.o ./targets/TARGET_NXP/TARGET_LPC408X/port_api.o ./targets/TARGET_NXP/TARGET_LPC408X/rtc_api.o ./targets/TARGET_NXP/TARGET_LPC408X/sleep.o ./targets/TARGET_NXP/TARGET_LPC408X/us_ticker.o ./rtos/TARGET_CORTEX/rtx5/TARGET_RTOS_M4_M7/TOOLCHAIN_GCC/irq_cm4f.o ./rtos/TARGET_CORTEX/rtx5/RTX_Config.o ./rtos/TARGET_CORTEX/rtx5/rt_OsEventObserver.o ./rtos/TARGET_CORTEX/rtx5/rtx_delay.o ./rtos/TARGET_CORTEX/rtx5/rtx_evflags.o ./rtos/TARGET_CORTEX/rtx5/rtx_evr.o ./rtos/TARGET_CORTEX/rtx5/rtx_kernel.o ./rtos/TARGET_CORTEX/rtx5/rtx_lib.o ./rtos/TARGET_CORTEX/rtx5/rtx_memory.o ./rtos/TARGET_CORTEX/rtx5/rtx_mempool.o ./rtos/TARGET_CORTEX/rtx5/rtx_msgqueue.o ./rtos/TARGET_CORTEX/rtx5/rtx_mutex.o ./rtos/TARGET_CORTEX/rtx5/rtx_semaphore.o ./rtos/TARGET_CORTEX/rtx5/rtx_system.o ./rtos/TARGET_CORTEX/rtx5/rtx_thread.o ./rtos/TARGET_CORTEX/rtx5/rtx_timer.o ./rtos/TARGET_CORTEX/rtx4/cmsis_os1.o ./rtos/TARGET_CORTEX/mbed_boot.o ./rtos/TARGET_CORTEX/mbed_rtx_handlers.o ./rtos/TARGET_CORTEX/mbed_rtx_idle.o ./rtos/ConditionVariable.o ./rtos/EventFlags.o ./rtos/Mutex.o ./rtos/RtosTimer.o ./rtos/Semaphore.o ./rtos/Thread.o ./platform/ATCmdParser.o ./platform/CallChain.o ./platform/FileBase.o ./platform/FileHandle.o ./platform/FilePath.o ./platform/FileSystemHandle.o ./platform/LocalFileSystem.o ./platform/Stream.o ./platform/mbed_alloc_wrappers.o ./platform/mbed_application.o ./platform/mbed_assert.o ./platform/mbed_board.o ./platform/mbed_critical.o ./platform/mbed_error.o ./platform/mbed_interface.o ./platform/mbed_mem_trace.o ./platform/mbed_mktime.o ./platform/mbed_poll.o ./platform/mbed_retarget.o ./platform/mbed_rtc_time.o ./platform/mbed_sdk_boot.o ./platform/mbed_semihost_api.o ./platform/mbed_stats.o ./platform/mbed_wait_api_no_rtos.o ./platform/mbed_wait_api_rtos.o ./hal/mbed_flash_api.o ./hal/mbed_gpio.o ./hal/mbed_lp_ticker_api.o ./hal/mbed_pinmap_common.o ./hal/mbed_sleep_manager.o ./hal/mbed_ticker_api.o ./hal/mbed_us_ticker_api.o ./features/netsocket/cellular/generic_modem_driver/OnboardCellularInterface.o ./features/netsocket/cellular/generic_modem_driver/PPPCellularInterface.o ./features/netsocket/cellular/generic_modem_driver/UARTCellularInterface.o ./features/netsocket/NetworkInterface.o ./features/netsocket/NetworkStack.o ./features/netsocket/Socket.o ./features/netsocket/SocketAddress.o ./features/netsocket/TCPServer.o ./features/netsocket/TCPSocket.o ./features/netsocket/UDPSocket.o ./features/netsocket/WiFiAccessPoint.o ./features/netsocket/nsapi_dns.o ./features/mbedtls/src/aes.o ./features/mbedtls/src/aesni.o ./features/mbedtls/src/arc4.o ./features/mbedtls/src/asn1parse.o ./features/mbedtls/src/asn1write.o ./features/mbedtls/src/base64.o ./features/mbedtls/src/bignum.o ./features/mbedtls/src/blowfish.o ./features/mbedtls/src/camellia.o ./features/mbedtls/src/ccm.o ./features/mbedtls/src/certs.o ./features/mbedtls/src/cipher.o ./features/mbedtls/src/cipher_wrap.o ./features/mbedtls/src/cmac.o ./features/mbedtls/src/ctr_drbg.o ./features/mbedtls/src/debug.o ./features/mbedtls/src/des.o ./features/mbedtls/src/dhm.o ./features/mbedtls/src/ecdh.o ./features/mbedtls/src/ecdsa.o ./features/mbedtls/src/ecjpake.o ./features/mbedtls/src/ecp.o ./features/mbedtls/src/ecp_curves.o ./features/mbedtls/src/entropy.o ./features/mbedtls/src/entropy_poll.o ./features/mbedtls/src/error.o ./features/mbedtls/src/gcm.o ./features/mbedtls/src/havege.o ./features/mbedtls/src/hmac_drbg.o ./features/mbedtls/src/md.o ./features/mbedtls/src/md2.o ./features/mbedtls/src/md4.o ./features/mbedtls/src/md5.o ./features/mbedtls/src/md_wrap.o ./features/mbedtls/src/memory_buffer_alloc.o ./features/mbedtls/src/net_sockets.o ./features/mbedtls/src/oid.o ./features/mbedtls/src/padlock.o ./features/mbedtls/src/pem.o ./features/mbedtls/src/pk.o ./features/mbedtls/src/pk_wrap.o ./features/mbedtls/src/pkcs11.o ./features/mbedtls/src/pkcs12.o ./features/mbedtls/src/pkcs5.o ./features/mbedtls/src/pkparse.o ./features/mbedtls/src/pkwrite.o ./features/mbedtls/src/platform.o ./features/mbedtls/src/ripemd160.o ./features/mbedtls/src/rsa.o ./features/mbedtls/src/sha1.o ./features/mbedtls/src/sha256.o ./features/mbedtls/src/sha512.o ./features/mbedtls/src/ssl_cache.o ./features/mbedtls/src/ssl_ciphersuites.o ./features/mbedtls/src/ssl_cli.o ./features/mbedtls/src/ssl_cookie.o ./features/mbedtls/src/ssl_srv.o ./features/mbedtls/src/ssl_ticket.o ./features/mbedtls/src/ssl_tls.o ./features/mbedtls/src/threading.o ./features/mbedtls/src/timing.o ./features/mbedtls/src/version.o ./features/mbedtls/src/version_features.o ./features/mbedtls/src/x509.o ./features/mbedtls/src/x509_create.o ./features/mbedtls/src/x509_crl.o ./features/mbedtls/src/x509_crt.o ./features/mbedtls/src/x509_csr.o ./features/mbedtls/src/x509write_crt.o ./features/mbedtls/src/x509write_csr.o ./features/mbedtls/src/xtea.o ./features/mbedtls/platform/src/mbed_trng.o ./features/frameworks/utest/source/unity_handler.o ./features/frameworks/utest/source/utest_case.o ./features/frameworks/utest/source/utest_default_handlers.o ./features/frameworks/utest/source/utest_greentea_handlers.o ./features/frameworks/utest/source/utest_harness.o ./features/frameworks/utest/source/utest_shim.o ./features/frameworks/utest/source/utest_stack_trace.o ./features/frameworks/utest/source/utest_types.o ./features/frameworks/utest/mbed-utest-shim.o ./features/frameworks/unity/source/unity.o ./features/frameworks/greentea-client/source/greentea_metrics.o ./features/frameworks/greentea-client/source/greentea_serial.o ./features/frameworks/greentea-client/source/greentea_test_env.o ./features/filesystem/fat/ChaN/ccsbcs.o ./features/filesystem/fat/ChaN/ff.o ./features/filesystem/fat/FATFileSystem.o ./features/filesystem/bd/ChainingBlockDevice.o ./features/filesystem/bd/HeapBlockDevice.o ./features/filesystem/bd/MBRBlockDevice.o ./features/filesystem/bd/ProfilingBlockDevice.o ./features/filesystem/bd/SlicingBlockDevice.o ./features/filesystem/Dir.o ./features/filesystem/File.o ./features/filesystem/FileSystem.o ./events/equeue/equeue.o ./events/equeue/equeue_mbed.o ./events/equeue/equeue_posix.o ./events/EventQueue.o ./events/mbed_shared_queues.o ./drivers/AnalogIn.o ./drivers/BusIn.o ./drivers/BusInOut.o ./drivers/BusOut.o ./drivers/CAN.o ./drivers/Ethernet.o ./drivers/FlashIAP.o ./drivers/I2C.o ./drivers/I2CSlave.o ./drivers/InterruptIn.o ./drivers/InterruptManager.o ./drivers/RawSerial.o ./drivers/SPI.o ./drivers/SPISlave.o ./drivers/Serial.o ./drivers/SerialBase.o ./drivers/Ticker.o ./drivers/Timeout.o ./drivers/Timer.o ./drivers/TimerEvent.o ./drivers/UARTSerial.o -lstdc++ -lsupc++ -lm -lc -lgcc -lnosys -DMBED_DEBUG -DMBED_TRAP_ERRORS_ENABLED=1 -Wl,-n -Wl,--start-group -lstdc++ -lsupc++ -lm -lc -lgcc -lnosys -Wl,--end-group -Xlinker -Map="mbed-os.map" -Xlinker -print-memory-usage -Xlinker --gc-sections -Xlinker --wrap=main -Xlinker --wrap=_malloc_r -Xlinker --wrap=_free_r -Xlinker --wrap=_realloc_r -Xlinker --wrap=_memalign_r -Xlinker --wrap=_calloc_r -Xlinker --wrap=exit -Xlinker --wrap=atexit -shared -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=softfp -mthumb -T C:/Users/bmcdonnell/Documents/MCUXpressoIDE_10.0.2_411/workspace/mbed-os/Debug/linker-script-debug.ld
c:/nxp/mcuxpressoide_10.0.2_411/ide/tools/bin/../lib/gcc/arm-none-eabi/5.4.1/../../../../arm-none-eabi/bin/ld.exe: mbed-os.axf section `.dynstr' will not fit in region `FLASH'
c:/nxp/mcuxpressoide_10.0.2_411/ide/tools/bin/../lib/gcc/arm-none-eabi/5.4.1/../../../../arm-none-eabi/bin/ld.exe: section .dynsym loaded at [00066c64,000715e3] overlaps section .data loaded at [00066c64,000678b7]
c:/nxp/mcuxpressoide_10.0.2_411/ide/tools/bin/../lib/gcc/arm-none-eabi/5.4.1/../../../../arm-none-eabi/bin/ld.exe: section .dynamic loaded at [000678b8,0006795f] overlaps section .dynsym loaded at [00066c64,000715e3]
c:/nxp/mcuxpressoide_10.0.2_411/ide/tools/bin/../lib/gcc/arm-none-eabi/5.4.1/../../../../arm-none-eabi/bin/ld.exe: region `FLASH' overflowed by 67708 bytes
c:/nxp/mcuxpressoide_10.0.2_411/ide/tools/bin/../lib/gcc/arm-none-eabi/5.4.1/../../../../arm-none-eabi/bin/ld.exe: error: required section '.rel.plt' not found in the linker script
c:/nxp/mcuxpressoide_10.0.2_411/ide/tools/bin/../lib/gcc/arm-none-eabi/5.4.1/../../../../arm-none-eabi/bin/ld.exe: final link failed: Invalid operation
collect2.exe: error: ld returned 1 exit status
make: *** [mbed-os.axf] Error 1

12:30:08 Build Finished (took 17m:44s.626ms)

Labels (1)
0 Kudos
1 Solution
275 Views
lpcxpresso_supp
NXP Employee
NXP Employee

Although vanilla Eclipse does provide some related functionality here - it is not something support by our project frontend (and note that we don't actually support shared library projects at all).

But allowing an executable project to be "automatically" converted into a static library is not something I can ever remember us being asked for before in MCUXpresso IDE (or in its LPCXpresso IDE and Red Suite ancestors). It is something I can add to our list of potential features to consider for a future release - but that means it isn't something that is going to be available to you in the near term.

Thus the only options you have right now beyond what we have already suggested is to approach the mbed team and suggest that they consider allowing the export of static library as well as executable projects. This of course would remove any need for you to convert a project into static library at all.

PS : I suspect that converting the project by editing the .cproject file manually wouldn't actually be that hard once you had examined the contents of a couple of examples of each type of project. And could probably be done using a fairly simple python script or similar if it were something you expected to want to do frequently.

Regards,

MCUXpresso IDE Support

View solution in original post

0 Kudos
4 Replies
276 Views
lpcxpresso_supp
NXP Employee
NXP Employee

Although vanilla Eclipse does provide some related functionality here - it is not something support by our project frontend (and note that we don't actually support shared library projects at all).

But allowing an executable project to be "automatically" converted into a static library is not something I can ever remember us being asked for before in MCUXpresso IDE (or in its LPCXpresso IDE and Red Suite ancestors). It is something I can add to our list of potential features to consider for a future release - but that means it isn't something that is going to be available to you in the near term.

Thus the only options you have right now beyond what we have already suggested is to approach the mbed team and suggest that they consider allowing the export of static library as well as executable projects. This of course would remove any need for you to convert a project into static library at all.

PS : I suspect that converting the project by editing the .cproject file manually wouldn't actually be that hard once you had examined the contents of a couple of examples of each type of project. And could probably be done using a fairly simple python script or similar if it were something you expected to want to do frequently.

Regards,

MCUXpresso IDE Support

View solution in original post

0 Kudos
275 Views
bmcdonnell_ionx
Contributor III

Thanks for the info.

LPCX support wrote:

It is something I can add to our list of potential features to consider for a future release

Yes please. Thanks for your consideration.

LPCX support wrote:

Thus the only options you have right now beyond what we have already suggested is to approach the mbed team and suggest that they consider allowing the export of static library as well as executable projects. This of course would remove any need for you to convert a project into static library at all.

Indeed, I am pursuing that. But I figured project conversion could've been a reasonable work-around. It is a feature that I've observed in other IDEs, such as Visual Studio (pictured below).

visual_studio_convert_exe_lib.png

0 Kudos
275 Views
lpcxpresso_supp
NXP Employee
NXP Employee

Hi Brendan,

currently there is no such functionality to convert a project to a static library in MCUXpressoIDE.

You need to manually create a new static library project and move the files you need in it. You can also try to manually tweak the .cproject file in you project, by comparing the differences with an MCUXpressoIDE static library project.

Regards,

MCUXpresso IDE Support Team

0 Kudos
275 Views
bmcdonnell_ionx
Contributor III

Thank you for confirming that the functionality is indeed missing, i.e. that I'm not missing something in the GUI.

Per my original question, why is that conversion ability not a feature? Why can I only convert an executable project to a shared library project, but not a static library project?

The mbed OS project (exported to MCUXpresso) has a very large and complicated setup. Both of your suggested workarounds would be tedious, difficult, and error-prone.

0 Kudos