Author Topic: Atmel-8390-WIRELESS-AVR2054-Serial-Bootloader Upload Error  (Read 14416 times)

0 Members and 1 Guest are viewing this topic.

Offline vishalTopic starter

  • Regular Contributor
  • *
  • Posts: 102
  • Country: in
Re: Atmel-8390-WIRELESS-AVR2054-Serial-Bootloader Upload Error
« Reply #50 on: September 19, 2017, 06:03:06 am »
Hi,The status message after the file transfer is attached .I couldnt see any function  in the application which calls the bootloader.c file.All those OTA upgrade only has dependency to OTAClient.c and OTAInterface.c.Also,the write page fucntions written in OTAInterface.Is that enough for the fucntioning?
« Last Edit: September 19, 2017, 06:07:27 am by vishal »
 

Online ataradov

  • Super Contributor
  • ***
  • Posts: 11236
  • Country: us
    • Personal site
Re: Atmel-8390-WIRELESS-AVR2054-Serial-Bootloader Upload Error
« Reply #51 on: September 19, 2017, 06:11:36 am »
It does not matter what that script says at this point.

OTA interface contains calls to two functions located in the bootloader - IAP_WRITE_PAGE_HANDLER and IAP_SWITCH_HANDLER. appGetIapHandler() is used to retrieve actual pointers. The problem is that it only reads words, which is enough on 128K devices, and not enough on 256K devices.

You need to figure out if standard C pointer is 2 or 4 bytes on that platform.

Basically forget about full OTA stuff for now. Just call appSwitch() anywhere from the application, and make things work so that iap_switch_handler() is called in the bootloader. Just called, it does not have to actually do anything, just blink an LED or something.

Once that works, the rest will work automatically.

It is a pretty short path in assembly, you should be able to easily trace it. If you can't, you should consider hiring someone to do this.
Alex
 

Offline vishalTopic starter

  • Regular Contributor
  • *
  • Posts: 102
  • Country: in
Re: Atmel-8390-WIRELESS-AVR2054-Serial-Bootloader Upload Error
« Reply #52 on: September 19, 2017, 09:10:43 am »
Basically forget about full OTA stuff for now. Just call appSwitch() anywhere from the application, and make things work so that iap_switch_handler() is called in the bootloader. Just called, it does not have to actually do anything, just blink an LED or something.

Once that works, the rest will work automatically.
appSwitch () and iap_switch_handler() is working..No doubt in it.If it works then why the application not restarted?

Quote

OTA interface contains calls to two functions located in the bootloader - IAP_WRITE_PAGE_HANDLER and IAP_SWITCH_HANDLER. appGetIapHandler() is used to retrieve actual pointers. The problem is that it only reads words, which is enough on 128K devices, and not enough on 256K devices.
appGetIapHandler() didnt see in any of the file
Quote
You need to figure out if standard C pointer is 2 or 4 bytes on that platform.
This one i am confused.Where it is specified as 2 or 4 byte.
« Last Edit: September 19, 2017, 09:12:29 am by vishal »
 

Online ataradov

  • Super Contributor
  • ***
  • Posts: 11236
  • Country: us
    • Personal site
Re: Atmel-8390-WIRELESS-AVR2054-Serial-Bootloader Upload Error
« Reply #53 on: September 19, 2017, 09:13:26 am »
appSwitch () and iap_switch_handler() is working..No doubt in it.
Can you elaborate how do you know it? I don't see how it can work with your current code.

appGetIapHandler() didnt see in any of the file
It is the first function in the otaInterface.c file.

This one i am confused.Where it is specified as 2 or 4 byte.
Either compiler documentation or experiment.
« Last Edit: September 19, 2017, 09:15:35 am by ataradov »
Alex
 

Offline vishalTopic starter

  • Regular Contributor
  • *
  • Posts: 102
  • Country: in
Re: Atmel-8390-WIRELESS-AVR2054-Serial-Bootloader Upload Error
« Reply #54 on: September 19, 2017, 09:28:45 am »
It is the first function in the otaInterface.c file.
Please have a look at following otaInterface.Am using otainterface for atmega256 device.Am attaching both 128 and 256 otaInterface file.and am working on otaInterface for avr256.In that the function is missing.Can you check wthethr the file am using is correct or not

 

Online ataradov

  • Super Contributor
  • ***
  • Posts: 11236
  • Country: us
    • Personal site
Re: Atmel-8390-WIRELESS-AVR2054-Serial-Bootloader Upload Error
« Reply #55 on: September 19, 2017, 04:24:38 pm »
That is not how those files look in the latest stack version to include OTA.

I'm not sure where yours came from, I can't see a single version where it was like this.
« Last Edit: September 19, 2017, 04:26:32 pm by ataradov »
Alex
 

Offline vishalTopic starter

  • Regular Contributor
  • *
  • Posts: 102
  • Country: in
Re: Atmel-8390-WIRELESS-AVR2054-Serial-Bootloader Upload Error
« Reply #56 on: September 20, 2017, 03:14:03 am »
That is not how those files look in the latest stack version to include OTA.
Where Can I get the latest version.I have worked on LwMesh_1_1_1 and LwMesh_1_2_1 and bootloader is provided with LwMesh_1_1_1 .and I got otaInterface.c file for avr-atmega256 from the following reference
http://www.avrfreaks.net/comment/925251#comment-925251
 

Online ataradov

  • Super Contributor
  • ***
  • Posts: 11236
  • Country: us
    • Personal site
Re: Atmel-8390-WIRELESS-AVR2054-Serial-Bootloader Upload Error
« Reply #57 on: September 20, 2017, 03:22:09 am »
LwMesh_1_1_1 contains the file I included. It is also your 128K file.

The thing is, both files are correct for both cases. Either of them will work, but you need to match what bootloader provides and what application expects. And standard bootloader is designed for the 128K style. You either need to change your application or bootloader.

You really need to understand how all this works. You can't make it work by pulling random bits form the internet.
Alex
 

Offline vishalTopic starter

  • Regular Contributor
  • *
  • Posts: 102
  • Country: in
Re: Atmel-8390-WIRELESS-AVR2054-Serial-Bootloader Upload Error
« Reply #58 on: September 20, 2017, 04:03:01 am »
My understanding is if we use default boot loader and application we should need to
1)program the bootloader
2)transfer the application using serial port
3)then further application modification is done via OTA using otaServer.
But what are the steps to follow if the booloader function is inclued in application itself.
 

Online ataradov

  • Super Contributor
  • ***
  • Posts: 11236
  • Country: us
    • Personal site
Re: Atmel-8390-WIRELESS-AVR2054-Serial-Bootloader Upload Error
« Reply #59 on: September 20, 2017, 04:06:26 am »
It is not about the steps. It is about how application talks to the bootloader.

You need to figure out a way to place a function that blinks an LED in the bootloader section and call that function from the application. However you do that is not important.

In the second option (your 256K file), function are located at fixed addresses. You still need a "bootloader" that contains those functions. There is no serial port stuff in that case. You will have to combine bootloader and application image manually (using some python script or whatever works for you).
Alex
 

Offline vishalTopic starter

  • Regular Contributor
  • *
  • Posts: 102
  • Country: in
Re: Atmel-8390-WIRELESS-AVR2054-Serial-Bootloader Upload Error
« Reply #60 on: September 20, 2017, 06:27:02 am »
It is not about the steps. It is about how application talks to the bootloader.
You need to figure out a way to place a function that blinks an LED in the bootloader section and call that function from the application. However you do that is not important.
yes.I tried such function and called it from application ..nothing has happened.First of all i programmed bootloader and initial image is loaded via serial port.That worked.Now my device have bootloader and initial image of application i suppose.Also I tried to see wthethr appSwitch() function is worked or not for OTA .That one also not worked.So I think my device have bootloader and application but while using OTA its not calling any of the function in bootloader.Do we need to specify anythng to make this function work.
« Last Edit: September 20, 2017, 06:31:33 am by vishal »
 

Online ataradov

  • Super Contributor
  • ***
  • Posts: 11236
  • Country: us
    • Personal site
Re: Atmel-8390-WIRELESS-AVR2054-Serial-Bootloader Upload Error
« Reply #61 on: September 20, 2017, 06:30:49 am »
Do we need to specify anythng to make this function work.
I'll say it one more time and I'm out of here.

You need to understand what are you doing and what is missing. You've got enough information to do this. Just take time to actually do it. I can't teach you programming in a forum thread.

Use the debugger and singe step though the program to see what is happening and what needs to happen.
Alex
 
The following users thanked this post: vishal

Offline vishalTopic starter

  • Regular Contributor
  • *
  • Posts: 102
  • Country: in
Re: Atmel-8390-WIRELESS-AVR2054-Serial-Bootloader Upload Error
« Reply #62 on: September 20, 2017, 06:33:19 am »
okay I will try ...Thank you so much for your great support.It was really helpful.I understood the basic facts .. Will try.
 

Offline vishalTopic starter

  • Regular Contributor
  • *
  • Posts: 102
  • Country: in
Re: Atmel-8390-WIRELESS-AVR2054-Serial-Bootloader Upload Error
« Reply #63 on: September 27, 2017, 12:47:30 pm »
Hi, I start it from the beginning. and I have done the following
1)I uploaded bootloader.
2)have loaded the initial image via serial interface
3)Tried OTA
While debugging I found that the appSwitch() function is not called
In OtaInterface.c the following lines of code is not working
Code: [Select]
else if(OTA_UPGRADE_COMPLETED_STATUS==status)
{
   appWritePage();
   appSwitch();
   appUpgradeInProgress=false;
}

and I have  seen in otaclient.c the above lines get invoked when calling the following.but that one also not become true .it shows that 0 !=otaclient.size
Code: [Select]
void OTA_ClientBlockConfirm(OTA_Status_t status){
 if(OTA_SUCCESS_STATUS==status && 0 ==otaclient.size){
   otaclientSendResponse(OTA_UPGRADE_COMPLETED_STATUS)
}
}
           Two blocks are written and after it shows "Error: unexpected status (OTA_NO_RESPONSE_STATUS)"..In one of the forum i read this error is because there is no bootloader.but in my case i have the bootloader and i could upload application via serial terminal.
           Also you have mentioned several times about 4-byte (size)  for avr-atmega256rfr2.Where can I check it and where I can I change it.I am using avr-gcc to compile.do it hav dependency.Kindly reply .
 

Online ataradov

  • Super Contributor
  • ***
  • Posts: 11236
  • Country: us
    • Personal site
Re: Atmel-8390-WIRELESS-AVR2054-Serial-Bootloader Upload Error
« Reply #64 on: September 27, 2017, 03:33:17 pm »
Forget about switch. Make sure that normal pages are written.

C pointer is 4 bytes on m256, check the size of the C pointer.
Alex
 

Offline vishalTopic starter

  • Regular Contributor
  • *
  • Posts: 102
  • Country: in
Re: Atmel-8390-WIRELESS-AVR2054-Serial-Bootloader Upload Error
« Reply #65 on: September 28, 2017, 04:49:21 am »
Before checking it  i have one more doubt
My linker scrpit is attached here with  and I changed the following lines in bootloader.c

Code: [Select]
__attribute__((section(".iap.write_page"))) void (*iap_write_page)(uint32_t, uint16_t *) = iap_write_page_handler;
__attribute__((section(".iap.switch"))) void (*iap_switch)(void) = iap_switch_handler;
to
Code: [Select]
__attribute__((section(".boot.write_page"))) void iap_write_page_handler(uint32_t addr, uint16_t *buf);
__attribute__((section(".boot.switch"))) void iap_switch_handler(void);
Is there any error with this line
While compiling with this change it shows the error "lf section `.boot' will not fit in region `boot'"..how can I  change the memroy value to fit the boot section
 

Online ataradov

  • Super Contributor
  • ***
  • Posts: 11236
  • Country: us
    • Personal site
Re: Atmel-8390-WIRELESS-AVR2054-Serial-Bootloader Upload Error
« Reply #66 on: September 28, 2017, 04:57:24 am »
Region 'boot' is declared as 4 bytes in size.
Alex
 

Offline vishalTopic starter

  • Regular Contributor
  • *
  • Posts: 102
  • Country: in
Re: Atmel-8390-WIRELESS-AVR2054-Serial-Bootloader Upload Error
« Reply #67 on: September 28, 2017, 11:14:07 am »
Region 'boot' is declared as 4 bytes in size.
I solved it by incresing the size from 4 to 264.now the boot section fit in to the memory.
Forget about switch. Make sure that normal pages are written.
I cant write the normal pages.The flash image of the device is attached

Quote
C pointer is 4 bytes on m256, check the size of the C pointer.
Where can I see the size.Is it in the linker script or its depend on compiler?
 

Online ataradov

  • Super Contributor
  • ***
  • Posts: 11236
  • Country: us
    • Personal site
Re: Atmel-8390-WIRELESS-AVR2054-Serial-Bootloader Upload Error
« Reply #68 on: September 28, 2017, 03:09:36 pm »
Where can I see the size.Is it in the linker script or its depend on compiler?
Google it, or compile a simple program and see hoe big the pointer is.

But with your new bootloader approach, it does not matter. All you need to do now is use the same script for the application, and may be a bit debugging. With this approach compiler should figure out how to execute those functions.

Forget about writing flash. Make sure that you can reliably call function from the application to the bootloader.
Alex
 

Offline vishalTopic starter

  • Regular Contributor
  • *
  • Posts: 102
  • Country: in
Re: Atmel-8390-WIRELESS-AVR2054-Serial-Bootloader Upload Error
« Reply #69 on: September 29, 2017, 02:55:59 am »
Forget about writing flash. Make sure that you can reliably call  function from the application to the bootloader.
If I  want to write a function to blink an led ; I write the function in bootloader.c .then how can I call it from application..Is it in the same way that IAP_SWITCH_HANDLER  and IAP_WRITE_PAGE_HANDLER in otaInterface.c .
 

Online ataradov

  • Super Contributor
  • ***
  • Posts: 11236
  • Country: us
    • Personal site
Re: Atmel-8390-WIRELESS-AVR2054-Serial-Bootloader Upload Error
« Reply #70 on: September 29, 2017, 02:57:25 am »
Yes. It is exactly the same. The exact details depend on which version of the linker script you are using.
Alex
 

Offline vishalTopic starter

  • Regular Contributor
  • *
  • Posts: 102
  • Country: in
Re: Atmel-8390-WIRELESS-AVR2054-Serial-Bootloader Upload Error
« Reply #71 on: September 29, 2017, 03:05:07 am »
IAP_SWITCH_HANDLER defines (SYS_DEVICE_SIZE -4) .Is it the memory loaction that the funcion points to?.If I have BLINK_LED what should it defines? Do we need to care anythng in function naming(i,e to use the same name in boot loader and otainterface).
 

Online ataradov

  • Super Contributor
  • ***
  • Posts: 11236
  • Country: us
    • Personal site
Re: Atmel-8390-WIRELESS-AVR2054-Serial-Bootloader Upload Error
« Reply #72 on: September 29, 2017, 03:07:02 am »
That is a location of a pointer to a function inside the bootloader. This is not what you want for your last linker script.

But I don't get how you can continue like this without trying to do any investigation on your own. I will not teach you how to debug things, there are plenty of tutorials on this.
Alex
 

Offline vishalTopic starter

  • Regular Contributor
  • *
  • Posts: 102
  • Country: in
Re: Atmel-8390-WIRELESS-AVR2054-Serial-Bootloader Upload Error
« Reply #73 on: September 29, 2017, 08:29:31 am »
But I don't get how you can continue like this without trying to do any investigation on your own. I will not teach you how to debug things, there are plenty of tutorials on this.
Sorry, Actually I am not well aware of the linker script.I know here its used to link bootloader and application.But what address should be given and how it depends on the application is unknown.I am debugging the OTA client and OTA interface to see what part works and doesn't.
 

Online ataradov

  • Super Contributor
  • ***
  • Posts: 11236
  • Country: us
    • Personal site
Re: Atmel-8390-WIRELESS-AVR2054-Serial-Bootloader Upload Error
« Reply #74 on: September 29, 2017, 04:11:05 pm »
Sorry, Actually I am not well aware of the linker script.
It is time to learn.

I know here its used to link bootloader and application.
Linker script is just an instructions on where to put things on the memory. You need to understand what things you put there and where, and then it will be obvious how to make them work.

But what address should be given and how it depends on the application is unknown.
You should know it, you are designing the application, it is up to you do define that.
Alex
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf