- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have a workspace with three projects:
1. Bootloader
2. Bootloader and Bootloadble "Image1"
3. Bootloader and Bootloadable " Image2"
I can attach to running target for Image1 and the debugger (after reset) will stop at line 1.
But
for Image 2 I get the following error in the output window
The target program has stopped at: file: line: -1 function: ?? address: 0x00021CDC
Applying reset always ends up at ine -1.
Disasembly windows shows I am looking at the right image.
Single step or Go, doesn't do anything
Any insight is greatly appreciated.
Giri
- Labels:
-
PSoC 5 Device Programming
-
PSoC 5LP
- Tags:
- bootloadable debug
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Can you please attach the project
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Can you please mention the application of Bootloader_App1 and Bootloader_App2 components in your design
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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))
{
Bootloader_App1_SetActiveAppInMetadata(btldrData);
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This call
Bootloader_App1_SetActiveAppInMetadata(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?
Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
Regards, Jeff
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Jeff:
thanks for taking the time with this project.
Two things.
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.
Giri
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I can also look at your project, if you would like some help.
Giri
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Giri;
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Jeff:
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.
Giri
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Jeff:
Is the I2C a custom component?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
No to the custom component.
Here is what I am really trying to do longer term.
Using PsoC creator load in and run my application #1. That works now.
Then when my App #1 gets notified that there is new code available from my server, go get the data (the correct _x.cyacd) and parse it and in this case, save it to image area #2. Note: I would like each image to run from a fixed flash location but not sure if that is needed). Then using the API, tell the bootloader that app #2 ready to run and reset.
The next time the new code is available, it uses image area #1 to save things to.
Does that make sense? My application know how to receive the files, parse it (though that is not done yet) and write it to flash already. It is this startup stuff that is not working.
I will try the host app you speak about. Maybe I switch back to the UART like your sample showed? thoughts?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Can I somehow get both apps loaded and using the switching logic, just load #1 or #2 based on what I set the metadata too?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I think you can do that, but I ran into trouble that the community could not get me out of which is that writes to the metadata always failed. It seems I should be able to do it..
just could not get the metadata written.There are a couple of static calls in the bootloader that I was going to Unstatic and try it. Have not gotten around to it.
Other things broke 😞
I had the requirement to switch to the other image by application control. I still don't know how I will satisfy this if I can't write to the metadata.
But when I looked at what the bootloader does, I decided to go with that because
1. It does integrity check before loading
2. If the flash is bad, it automatically switches to the other hopefully good image
3 or it will hang out at the base bootloader.
I would have to build all that into the application, and debug it.
I decided not to put that effort into doing all of this in my application.
I think the metadata stores the start location of the images. App1 is defined to be in the next row after the bootloader. But App2 location is stored in metadata (read that in the docs).