Can you please attach the project
Can you please mention the application of Bootloader_App1 and Bootloader_App2 components in your design
The workspace is a test app.
Application 1 and two simply blink an different led.
App1 blinks LED1 and App2 blink led2.
When I think Pin 3/3 is pulled low, the bootloader is started.
in order to change or repair any metadata rows, the PSoC Bootloader component v1.50 calls the SetActiveAppInMetadata() function after each reset (near the end of the Bootloader_Start() function).
This function then calls ...SetFlashByte(), which will call CySysFlashWriteRow() (in Flash.c, see code location pictures in attachment).
In most cases the active app (and all the other metadata content) would stay the same, because it only changes when uploading a new firmware through the bootloader.The above mentioned calls are performed even if the content of the metadata row does not see any change
The current component implementation is done in this format.
If you want to modify the component, first have to create a component library, then you will be able to import an existing component into your library.
File->New->Project, then click the "Other" tab, and select "PSoc Library"
In the workspace explorer, you can then click on the components tab, then right click and import component.
Change the source library to the PSoC creator one, and choose your component.This document should be helpful http://www.cypress.com/file/137436/download
I understand about the bootloader.
But a similar call also exists in the bootloadable component - to update metadata.
This is what I was trying. This call fails with error 9.
Are you saying that just to make the current active app to set the NonActive app as active I will have to create a new component?
That area of flash isn't locked, so why can't I write to that row?
My requirement is to switch the active app only.
Can you please make sure that the to be active app is valid using the API to validate. Example is given below,
if(0x00u == Bootloader_App1_ValidateBootloadable(btldrData))
is a static function in Bootloader_app1.c.
So I cannot call it from main, unless you want me to modify bootloader_app1.c.
Is that the experiment you want to run?
Is there any chance you could help me understand how to load your project? Meaning I need to understand how you get the 2nd image in the flash. I have walked thru your code and have it booting and running the first app but because I havent figured out how to load the 2nd image, it doesnt jump.
I did change your UART to a I2C component but that should not matter..
Hopefully you can help me out here? I am sure you are busy but I am stuck. Your application is exactly what I have been trying to do.
Thanks in advance for any help or guidance.
thanks for taking the time with this project.
I found out just recently from my FAE, to debug the 2nd bootable project
- got to -- Right CLick on the 2nd Bootable project, then Build Settings -> Debug --> Debug Target.
Here use the pull down to select "Application Code and Data 2".
This will set up the infrastructure to be able to step into the 2nd bootable project.
For my test app, you will have to pull loaderLaunch pin (P3/3) low.
This launches the bootloader. then you can use the BootLoader HOst GUI (It is the Cypress program path) to pick the
ComboAppProj2_2.hex to load the 2nd app.
THis will cause a reboot to happen and will load the 2nd app.
I can also look at your project, if you would like some help.
Thank you for responding. I modified your original one to work with my -042 kit. I have attached it for you to take a look at. Here are my notes so far:
Add a switch to P1.0 and ground. Also uses SW2 on the -042 kit
Attached is my latest code using the -042 kit. If you flash the bootloader, then the ComboAppProj1 you will see the following;
1.) Red LED flashes 10 times means started the bootloader
2.) Green LED flashes 20 times means Bootloadable started and you are in the main for ComboAppProj1
3.) Green LED turns off means it is waiting for you to close Pin_SwitchActive_Read() which is P1.0
4.) Depending on which app was running do one of the following:
- if App #1 was running, set App #2 active and turn on the red LED
- if App #2 was running, set App #1 active and turn on the blue LED
5.) Wait 5 seconds
6.) Now test to see what app is now active before the call to the boot loader
- if App #1 is now the active one, turn on the green LED
- if App #2 is now the active one, blink the green LED
7.) Wait 5 seconds
8.) Press the Pin_LoaderLaunch_Read() P0.7 to launch the new app. The green LED should stay ON for 5 seconds then turn off just before the call to the bootloader.
I would expect it to execute the other APP but because I cannot figure out how to initially load App #2 I am stuck. So I am getting closer...
Both apps are in the project. App #2 uses the blue LED like the green LED is used in App #1.
It seems that the app #1 code tests are working as I see it thinks App #1 is running, then I do the switch and now it thinks app #2 is now the active one. However, because I do not know how to get my second app loaded initially, #8 above never launches app #2.
Hopefully you can help? Thank in advance
I understand your issue now.
It will take a couple of hours for me to look at your project, but..
In my case, I am using a UART to download the App2.
For this instance, I downloaded AN68272's zip file.
This has multiple projects.
One of them is Uart_Bootloader Host GUI.
This gui does the Bootloader protocol to download App 2 and then set the metadata to make it active.
If you need I2C, I think there is APpNote on that too.
The GUI is what you will use to download the next App once you launch the BootLoader in App1.
The AppNote(s) <they have several one for different interfaces [AN86526 (I2C), AN73503 <USB>]
does explain this.
So when you launch the GUI, you will select the [AppName]2_2.hex to download your App2.
When you switch back to App1 - [AppName]1_1.hex is what you use.
let me know if this helps.
Is the I2C a custom component?