Post-build steps triggering too early

cancel
Showing results for 
Search instead for 
Did you mean: 

Post-build steps triggering too early

Jump to solution
464 Views
roy_vanlierop
Contributor III

I'm trying to fix the failed implementation of generating s-records by adding my own build-step. 

After building the application, the generated .srec file should be automatically aligned by using the srec_cat tool: 

roy_vanlierop_0-1620829864121.png

This "Post" build executes before the generation of the needed Srecords file. Thus causing the srec_cat executable too fail. 

roy_vanlierop_0-1620830355797.png

 

Could I get a work-around for this? Can I "Invoke" my own executable like Objcopy is invoked? 

 

0 Kudos
1 Solution
446 Views
jiri_kral
NXP Employee
NXP Employee

Hi,

this is known issue - but I think that it is already fixed in S32DS v3.4. So, the issue is that post build command is called right after .elf file is produced. And other tools (like .srec output and size) is called after post build step. 

As a more clean workaround you can create some .bat file (executed as a postbuild step) which creates .srec file from .elf and you can perform your srec_cat steps on that file. 

 

Jiri

View solution in original post

Tags (1)
0 Kudos
6 Replies
455 Views
roy_vanlierop
Contributor III

Found a workaround by abusing the "Print Size" feature: 

roy_vanlierop_0-1620835444674.png

 

0 Kudos
447 Views
jiri_kral
NXP Employee
NXP Employee

Hi,

this is known issue - but I think that it is already fixed in S32DS v3.4. So, the issue is that post build command is called right after .elf file is produced. And other tools (like .srec output and size) is called after post build step. 

As a more clean workaround you can create some .bat file (executed as a postbuild step) which creates .srec file from .elf and you can perform your srec_cat steps on that file. 

 

Jiri

View solution in original post

Tags (1)
0 Kudos
346 Views
roy_vanlierop
Contributor III

Hello @jiri_kral,

After migrating to S32DS 3.4 the bug is still not fixed. The Tool Chain Editor displays the following error:

roy_vanlierop_0-1623323416631.png

This is a new project, nothing changed. 

0 Kudos
335 Views
jiri_kral
NXP Employee
NXP Employee

Hi, 

I checked the ticket related to Post build steps - and the resolution is that this is correct behavior. The logic behind is that product of build is .elf file (or .a archive - depends on project type). After that is called user post build step and then are called external tools selected by user -> Print size/Create flash image/Create extended listing.  

 

Anyway - I tried reproduce the error message in toolchain editor - but no success. How did you get this error? 

 

Jiri 

0 Kudos
332 Views
roy_vanlierop
Contributor III

Hello Jiri,

It's too bad that this is desired/intended behavior. For anyone who comes after me and want to modify s-records in the Post-Build step:

${cross_prefix}${cross_objcopy}${cross_suffix} -O srec  ${ProjName}.elf tmp.srec; "${ProjDirPath}/Tools/srec_cat.exe" tmp.srec -fill 0x00 -within tmp.srec -range-padding 256 -address-length=4 -obs=32 -o aligned_${ProjName}.srec;rm tmp.srec

This three step command calls the build-in ObjCopy instance, creates a fresh S-record and modifies it using srec_cat. 

The Tool Conflict error message came from a freshly installed S32DS 3.4 with a fresh new project. The error is visible in all my projects, even older projects. Project -> Properties -> C/C++ Build -> Tool Chain Editor -> Select Tools.

roy_vanlierop_0-1623401943456.png

 

0 Kudos
415 Views
roy_vanlierop
Contributor III

It's too bad the S32DS doesn't support the S32K microcontrollers. When will S32K DS for Arm be updated?

 

0 Kudos