Giter Club home page Giter Club logo

Comments (3)

devanlai avatar devanlai commented on May 30, 2024

Hi @vicgwee, perhaps I should have documented the highboot bootloader a little better.

When it writes the application into flash, it modifies the contents of the vector table in the first flash sector so that the reset address points to the bootloader instead of the application. This ensures that the bootloader is the first program to run. When the bootloader decides to boot the application, it then jumps to the application's reset address which is stored in an unused slot in the vector table.

The bootloader attempts to appear totally transparent compared to if there were no bootloader installed, so if you perform a firmware upload, you would expect to get back the same firmware that you put in, which means it does not include the modified vector table or the bootloader itself, so if you flash that image with st-flash, it's not any different than if you were to just flash the original image with st-flash.

Could you elaborate a bit on what you're trying to accomplish? Did you want to create single flashable image that includes the bootloader and the application together? If so, you could potentially do this with a bit of careful linker script construction or by using st-flash to read out the complete flash contents directly rather than using the dfu upload capability to read back the firmware.

from dapboot.

vicgwee avatar vicgwee commented on May 30, 2024

Hi @devanlai, thanks for the quick response! I see, the bootloader's 'totally transparent' feature has worked very well :) I was quite surprised when the vector tables were the same!

Yes, I would like my build tool to create a single flashable image so that whenever I use my ST-Link, I don't have to re-flash the bootloader and then download my program using the bootloader. Would you recommend using the highboot or the standard bootloader for that?

EDIT: I took a look at some of the history of highboot and saw it was mentioned in #23 that

The high-memory bootloader has a brief window of danger when rewriting the mixed application/bootloader vector table where it can brick itself if it is reset or power is lost in the middle of the middle of erasing / writing the vector table.

Since that is the case, I would prefer to use the standard bootloader instead!

from dapboot.

devanlai avatar devanlai commented on May 30, 2024

There are a few different ways to generate a combined image.

If you're generating a bin file, it's an exercise in taking the bootloader bin file and padding it until the size equals to the application offset (which is 8KiB for the standard dapboot image). If you don't mind padding with zeroes (which means the padding will be written into the flash instead of just erasing flash to 0xFF), there are some shell-script friendly ways to do so with dd, e.g: How to pad a file to a desired size.
For padding with 0xFF, it's not as straightforward to use common shell tools so I just use a small Python script.

If you're generating a hex file, there are utilities that can handle merging hex files together, e.g: Merging 2 hex files.

from dapboot.

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.