Integrating Python script/Python-converted -exe in MAKEFILE

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
SaSh_4649506
Level 2
Level 2
5 replies posted 5 questions asked 5 sign-ins

Hello all,

I want to integrate a python script/python-converted-exe(using pyinstaller --onefile <file.py>) in the Makefile.

The python script/exe works fine when using it as a stand-alone unit. However, when I try to integrate the exe in the Makefile and try building the application (snip.pers-BCM943909WCD1_3.B1-ThreadX-NetX_Duo-debug ota2_download), I get the following error:

[11816] INTERNAL ERROR: cannot create temporary directory!
make.exe[2]: *** [main_app] Error -1
make.exe[1]: *** [bootloader] Error 2
make.exe[1]: *** Waiting for unfinished jobs....
WICED/platform/MCU/BCM4390x/BCM94390x_targets.mk:256: recipe for target 'bootloader' failed
[10200] INTERNAL ERROR: cannot create temporary directory!
make.exe[2]: *** [main_app] Error -1
tools/makefiles/wiced_apps.mk:348: recipe for target 'sflash_write_app' failed
make.exe[1]: *** [sflash_write_app] Error 2
make: *** [main_app] Error 2
Makefile:359: recipe for target 'main_app' failed

 
 
 
 
 
 

Additional Info:

I want to merge certain output build files together to create one consolidated file : "merge_file.bin". The script is developed on Python 2.7.2. I converted the python script to an exe so that it is independent of system it is running on.

The purpose of integrating this script/exe in the Makefile is simple: after the binaries are successfully built, the script/exe will take the required files post-build and merge them together to produce a "merge_file.bin" .

 

Added Lines in the MAKEFILE:

1. Defined the exe with correct location:

MERGE_FILE = $(SOURCE_ROOT)merge_file.exe

2. Integration with MAKEFILE:

main_app: (some code)

$(QUIET)$(ECHO) Build complete
[line added]   $(QUIET)$(ECHO) Merging files...
[line added]  $(QUIET)$(MERGE_FILE)

In case anyone has worked on/ has knowledge on the same, please guide me on where I am going wrong and help me integrating the python script/python-converted-exe in the Makefile.

 

0 Likes
1 Solution

Hello all,

I am now able to integrate my Python script with the merged file.

1. Defined a function(like sflash/sflash_download) to call the python script

<function name>:
$(QUIET) $(PYTHON_FULL_NAME) $(SOURCE_ROOT)<python-script.py>

2. Call this function in $(BUILD_STRING)

 

This works for me. Hopefully will work for you too! 🙂

View solution in original post

2 Replies
Murali_R
Moderator
Moderator
Moderator
250 sign-ins 250 replies posted 100 solutions authored

If you want to integrate a python script in the Makefile, ensure that whatever changes that you do to the process is after whatever the build process that is carried out by the Makefile. This is to ensure that you don't break something related to the WICED SDK and since your goal is to merge the output files generated by WICED.

Also, I see that you have a OTA2 build string in your make target. If you want an ota2 image, the OTA2_image is generated by the WICED-SDK if you add 'ota2_image' string to your make target.

0 Likes

Hello all,

I am now able to integrate my Python script with the merged file.

1. Defined a function(like sflash/sflash_download) to call the python script

<function name>:
$(QUIET) $(PYTHON_FULL_NAME) $(SOURCE_ROOT)<python-script.py>

2. Call this function in $(BUILD_STRING)

 

This works for me. Hopefully will work for you too! 🙂