Building for two trivially different PSoC devices

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

cross mob
pderocco
Level 3
Level 3
10 replies posted 5 questions asked 5 replies posted

We were having trouble obtaining a particular PSoC 4 that we had been using, so ordered a substitute that adds an ADC that we don't need. It works fine, but it requires that I rebuild the code with that specific device specified. The only difference in the hex files is the metadata in segment 0x9050.

Since this is a bootloadable project, it includes a bootloader, which requires the same change to the device type. I notice that the silicon id actually appears somewhere in the code, so there is also a one-byte difference in the code, on top of the difference in the metadata.

Furthermore, the device type is not a build property, it's a project property.

For an automated build, this means I have to have two copies of each project, with one tiny difference between them, and run twice as many builds. I don't see any way to have two projects share the same source code and other resources, either. For manual builds, I either have to do the same thing, or I have to rename the artifacts from one set of builds, then edit the projects, then rerun the builds, then rename those artifacts under different names.

This sucks. I can probably find where in Bootloader.c it embeds the silicon id, and take that crap out. That would mean that in both bootloader and bootloadable, I'd only have a metadata difference. Is there a way to use a post-build step to modify this metadata? Everything I've tried to do manually to the hex file is rejected by the PSoC Programmer, so there's something in those last three undocumented bytes in the metadata that is foiling my attempts to make one build for two slightly different devices.

Does anyone have a solution for this?

0 Likes
1 Solution
BiBi_1928986
Level 7
Level 7
First comment on blog 500 replies posted 250 replies posted

Hello.

Yes, it's possible to have 1 set of common code between projects.  See this thread by  :
Solved: Sharing code in a workspace between projects - Infineon Developer Community

You should be able to select a different PSoC device within each project.

The benefit is, when Add Existing... is used, it's a reference to the source file, not a copy.  And yes, it will take a bit of effort to Add Existing...  the files, but once done, Build All and both projects are up-to-date.

Okay so far.  Now the schematic.  I'm speculating here since I've not done this myself.
For the schematic, you'll want a copy (not a reference) of the original schematic.  You'll need to change the bootloadable component dependencies to point to the bootloader for the alternate PSoC device.  So, this is not quite so elegant a solution, but hardware rarely changes (compared to software).

Can apply same method to Bootloader projects.

Hope this helps a bit.
Good luck with your project.

View solution in original post

0 Likes
1 Reply
BiBi_1928986
Level 7
Level 7
First comment on blog 500 replies posted 250 replies posted

Hello.

Yes, it's possible to have 1 set of common code between projects.  See this thread by  :
Solved: Sharing code in a workspace between projects - Infineon Developer Community

You should be able to select a different PSoC device within each project.

The benefit is, when Add Existing... is used, it's a reference to the source file, not a copy.  And yes, it will take a bit of effort to Add Existing...  the files, but once done, Build All and both projects are up-to-date.

Okay so far.  Now the schematic.  I'm speculating here since I've not done this myself.
For the schematic, you'll want a copy (not a reference) of the original schematic.  You'll need to change the bootloadable component dependencies to point to the bootloader for the alternate PSoC device.  So, this is not quite so elegant a solution, but hardware rarely changes (compared to software).

Can apply same method to Bootloader projects.

Hope this helps a bit.
Good luck with your project.

0 Likes