Code Monkey home page Code Monkey logo

Comments (4)

xobs avatar xobs commented on May 27, 2024

Are you seeing expected behavior?

Toboot entry is forced after updating: https://github.com/im-tomu/tomu-bootloader/blob/master/booster/main.c#L74

The boot_count value out o be 0, which is why the BOOT_FAILED_TOO_MANY_TIMES code is surprising. What is the order of operations that you're doing?

from toboot.

lealanko-rt avatar lealanko-rt commented on May 27, 2024

Sorry, I wasn't clear. I meant the situation when reflashing the bootloader itself using an external programmer.

What I'm doing is that I have both the bootloader and an application already in flash, and then I use OpenOCD and J-Link to flash a new version of the bootloader through the SWD pins, without touching the application. After I reset run in OpenOCD, I expect the bootloader to run and boot the application.

However, the process of reflashing the bootloader through SWD seems to scramble some of the RAM, at least the boot token. I expect the RAM is used as a buffer during flashing, or something. So what happens is that the bootloader looks at the reset cause, and sees that it is not PORST, and therefore expects the boot token to be valid, even though it contains some random fluff after the flashing. (I don't have the exact memory values available right now.)

Everything works fine after power-toggling the device, so it's just an inconvenience for toboot developers.

from toboot.

xobs avatar xobs commented on May 27, 2024

Since it's generally a 32-bit machine, what if we only consider the boot_count to be valid if board_model is correctly set? Most processes (such as OpenOCD) will overwrite entire words, so those would invalidate the boot_count value as well.

from toboot.

lealanko-rt avatar lealanko-rt commented on May 27, 2024

I feel using an eight-bit number for this purpose is a bit hazardous. And I doubt anything would scramble the second word in RAM while leaving the first one (magic number) intact. So I still think just having a special value in the magic field should be enough.

from toboot.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.