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

PSoC™ Creator & Designer Forum Discussions

JoBr_1593366
Level 5
Level 5
100 sign-ins 50 questions asked 100 replies posted

cybtldr_api2.h contains the "higher-level API that handles the entire bootload operation". I've successfully used CyBtldr_Program from this file to create a firmware update tool that reads from an external .cyacd file. However, I would like to embed the data from the .cyacd file directly into the executable so there is just one self-contained file to distribute to customers. I don't see any alternative to CyBtldr_Program that can handle this, though.  Is there one? 

CyBtldr_Program calls CyBtldr_RunAction, which calls CyBtldr_OpenDataFile, which uses fopen, so it needs a real file and can't work with internal data.  Is there any way to handle this that's pre-written, or do I have to write it myself?  Either converting the ASCII .cyacd file itself into xxd -i format:

unsigned char firmware_v1_0_cyacd[] = {
0x31, 0x45, 0x30, 0x37, 0x44, 0x30, 0x36, 0x39, 0x30, …

or converting the hex cyacd file data to an actual byte stream:

unsigned char firmware_v1_0[] = {
0x1E, 0x07, 0xD0, 0x69, 0x03, 0x30, 0x00, … 

Either way is fine with me.

0 Likes
2 Replies
BiBi_1928986
Level 7
Level 7
500 replies posted 250 replies posted 250 sign-ins

Hello.

I understand what you're looking for.  It will simplify your customer upgrade process.

I looked at the app note for PSoC4 I2C Bootloader, AN86526.  This embeds the bootloadable as a string array into a Host application (loaded into a PSoC4 as a Host programmer).  In place of fopen, the Host calls BootloadStringImage().

Read section 2.3 for details of the I2C Host application and carefully read section 2.3.3 for the Host details.
You can download the zip file containing AN86526 along with Host source files from here:
Infineon Technologies

Obviously, you'll need to re-target/compile for your PC (instead of PSoC4) and configure the communication channel for downloading (not likely using I2C).  It should be straight forward (famous last words).

AN68272 is a Host Bootloader for PSoC 5LP using a UART.  Again, with an embedded bootloadable as an array.  See section 2.5 and section 2.5.2 for 5LP Host.  This might be a better place to start if already using a UART for communication channel.

Hopefully this leads you in the right direction and I'm not steering you down the wrong road.
Bottom line..., you had the right idea to convert file into an array.
Good luck with your project.

OK, so BootloadStringImage() is roughly equivalent to RunAction_v0() in the original, but doesn't do things like CyBtldr_SetApplicationStatus(). 

So I kind of have to write my own, but I can merge the parts I want from these two.  Thanks!

0 Likes