Downloading, Building and Deploying the Firmware

Discussion and questions about boards that can run MicroPython but don't have a dedicated forum.
Target audience: Everyone interested in running MicroPython on other hardware.
User avatar
dhylands
Posts: 3821
Joined: Mon Jan 06, 2014 6:08 pm
Location: Peachland, BC, Canada
Contact:

Re: Downloading, Building and Deploying the Firmware

Post by dhylands » Sun Feb 26, 2017 2:56 am

It looks like the bootloader expects a CRC32 checksum to be stored in the image and MicroPython doesn't have one, which explains why it thinks its invalid.

You'd need to put something into the build to calculate that checksum and store it in the image.,

User avatar
SureshVakati
Posts: 42
Joined: Fri Feb 24, 2017 3:52 pm

Re: Downloading, Building and Deploying the Firmware

Post by SureshVakati » Tue Feb 28, 2017 7:17 pm

Hello Dave,
I got it working! Thank you!
Last edited by SureshVakati on Wed Mar 01, 2017 10:59 pm, edited 1 time in total.

huiyifach6
Posts: 1
Joined: Mon Nov 09, 2015 7:18 am
Contact:

Re: Downloading, Building and Deploying the Firmware

Post by huiyifach6 » Sat Mar 04, 2017 6:29 am

I also followed what you said above.











___________________________________
Love me, love my dog!
[url=http://www.dentaldeal.es/]depósito dental[/url]

User avatar
SureshVakati
Posts: 42
Joined: Fri Feb 24, 2017 3:52 pm

Re: Downloading, Building and Deploying the Firmware

Post by SureshVakati » Tue Mar 14, 2017 7:32 pm

Hello Dave,
Is there anyway that I can write a magic value to SRAM? I am trying to do OTA for STM32f405, I had methods to download the firmware and bootloader has code to update the firmware, now the bootloader checks for a magic value in SRAM, if it is there then it will do the update process. Can I write magic values like below from micropython?This is in 'C'

Code: Select all

*((DWORD *)0x2001FFFC) = 0xCAFE0001; // Write Magic value to SRAM
NVIC_SystemReset();
Bootloader checks that value while booting.

Code: Select all

 if (BootState == 0xCAFE0001)
    AppErase(APPLICATION_BASE);

  if (ApplicationFirmwareCheck() && !BreakKeyCheck())
  {
    printf("Application Valid\n");

    while(USART_GetFlagStatus(USART3, USART_FLAG_TC) == RESET); /* Wait for characters to leave */

    USART_Cmd(USART3, DISABLE);  /* Disable the USART3 */

    RCC_APB1PeriphClockCmd(RCC_APB1Periph_USART3, DISABLE); /* Disable USART3 Clock */

    Reboot_Application(); // Does not return
  }
  else
  {
    printf("Application Missing or Corrupt\n");

    test(); // DFU Burner
  }
Writing the value to a file in SD card is another alternative, but this code is already tested and been working fine, so just thinking to keep everything as same in my project.

User avatar
dhylands
Posts: 3821
Joined: Mon Jan 06, 2014 6:08 pm
Location: Peachland, BC, Canada
Contact:

Re: Downloading, Building and Deploying the Firmware

Post by dhylands » Wed Mar 15, 2017 12:27 am

SureshVakati wrote:Hello Dave,
Is there anyway that I can write a magic value to SRAM? I am trying to do OTA for STM32f405, I had methods to download the firmware and bootloader has code to update the firmware, now the bootloader checks for a magic value in SRAM, if it is there then it will do the update process. Can I write magic values like below from micropython?This is in 'C'

Code: Select all

*((DWORD *)0x2001FFFC) = 0xCAFE0001; // Write Magic value to SRAM
NVIC_SystemReset();
In MicroPython, the equivalent of those 2 lines would be:

Code: Select all

import machine
import stm

stm.mem32[0x2001FFFC] = 0xCAFE0001
machine.reset()
Note: pyb.hard_reset() is the same thing as machine.reset()

Post Reply