Your external flash/EEPROM is SPI based ? You need to modify the bootloader project to copy image from external memory to the PSoC flash and launch it.
- Create a project with bootloader-bootloadable architecture.
- While you running bootlodable (application space of flash), you receive new image and you write it into external memory.
- Once writing to external memory is done, you verify it by calculating checksum.
- If checksum is okay, you launch bootloader().
- Execution jumps to bootloader space of PSoC5 flash.
- Bootloader project copies new image from external memory to the application space of flash.
- Verify checksum and launch application.
There is one more method to achieve it without requiring an external memory. PSoC itself can divide its memory into two halves. One portion bootloading the other portion. Read dual-bootloader in PSoCLP bootloader component. The drawback is your application can get only half of the total flash size.
- PSoC5 flash is divided into launcher, app1 (bootloadable1) and app2 (bootlodable2) portions.
- App1 while running if receives new image, it writes to app2 space. Validates the new image and sets a flag.
- Similarly, if app2 is running it stores new image into app1 space.
- Launcher at power up selects which app to launch and execution goes to app1 or app2.
Thanks Pavan for your solution.
I know the second method of dual application Bootloader.However, can you elaborate how to write in external memory because when we call Bootloader_Start() function it automatically copies the application *.cyacd file in the internal memory.
1 of 1 people found this helpful
To write new image to external memory, you must be receiving the new image from some host. From where are you receiving the new image ? Is it over UART, I2C or USB ?
Are you using your own app to send this new image ? If so, you can send new image row by row and store the data into external memory. For every row of data you receive you can cross check checksum and if the checksum sent by host is same as calculated checksum, you write the received row of data to external memory. Writing to external memory depends on what type of memory you are using - SPI, I2C etc.
By the way, Bootloader_Start() function waits for host application to send flash data and writes to PSoC flash. It does not go and fetch data from external memory. You have to write this part.
I am receiving new application image from Bootloader host tool in PSoC creator over UART. And yes that is what I want to know how to write the code to fetch data from external memory.Can you give me any reference or steps to be followed for writing code to write data on extrnal memory and fetch data from external memory.
1 of 1 people found this helpful
1) I have some code writing data into external EEPROM over I2C. However, I need a day to search that and provide here. Is your external memory an I2C based EEPROM ? Usually, it is just initializing the EEPROM at the beginning and then just send address and data for writing. If you send me datasheet or part number of your external memory I will be able to help.
2) Can you confirm why you don't want dual bootloader architecture ? It is worthwhile to conisder this approach because in this case, you don't need any external memory and any custom code.
Thanks embedded.engg ,
However what I want to know is, when we write Bootloader_start function it do all the work on its own. We just have to send application image from host tool given in PSoC creator and it automaticaaly saves the image file in controller's flash.So what I want to know is how to send that image in external flash memory.
Because when Bootloader_start() function is called it never returns and we can't add our code inside this function.
As you said, Bootloader_Start you can use to copy image from host to flash. However, for your case, you need to
1) In your bootloadable project (application), copy the new image from host and write it to EEPROM. For this, I have provided you I2C EEPROM APIs. Use CyEEBtldrCommWrite() for writing to EEPROM.
2) Once you write image to EEPROM, you invoke Bootloader_Load() which will never return as you said. Even here, you need to modify bootloader component code to read from EEPROM instead of waiting for command from host. The code should read from EEPROM and write to PSoC flash.
I hope you are understanding what I am trying to tell you. Why don't you use dual bootloader instead of writing this custom code ?
1)I know In my Bootloadable project I can copy new image from host and write it to EEPROM
2)The main problem I am facing is how to modify my bootloader component to read from EEPROM instead of waiting for commands from host.
yes I understood what you said.My project requires me to do so that's why I am not using dual app bootloader and I know about dual app bootloader.
I hope you are understanding what I am trying to ask
The main problem I am facing is how to modify my bootloader component to read from EEPROM instead of waiting for commands from host.
See this link.
You need to import the component and then modify the host_link API to read EEPROM and write into PSoC flash.
Can someone please tell me how to switch between applications in dual application bootloader.