lancaster-university / microbit-dal

http://lancaster-university.github.io/microbit-docs
Other
255 stars 130 forks source link

Start / End Addresses in Memory Map incorrect #365

Closed microbit-sam closed 6 years ago

microbit-sam commented 6 years ago

The address stored in the memory map don't make sense!

MicroBitPartialFlashingService calculates the beginning of the MakeCode region by rounding FLASH_PROGRAM_END:

without BLE  with BLE
FLASH_PROGRAM_END 0x00031ac8   0x000333d4
MakeCode start    0x00031c00   0x00033400
MakeCode magic    0x00031c00   0x00033800

@finneyj I'll fix this against the dal-integration branch

martinwork commented 6 years ago

How about the following? It stores the address where the magic is found in the MakeCode region start address.

` /*

`

microbit-sam commented 6 years ago

Yep this looks like the right idea - thanks Martin!

I'll have a go at implementing this, maybe with the mumur hash instead? How fast could you hash the DAL when you used it? Originally chose to use the embedded hashes to avoid having to hash the flash on the device

martinwork commented 6 years ago

The thing about the code above is that it provides the correct makecode region start address rather than the one calculated by rounding FLASH_PROGRAM_END.

Calculating the hash is the way we need to go. Is there a need to check the embedded one as well? The suggestion was that we check the embedded hashes before calculating one.

martinwork commented 6 years ago

The above code has several problems, not least that it embeds the MakeCode magic in the DAL, which causes the old code to fail! I have created a PR with code that I have compiled and tested.

finneyj commented 6 years ago

@microbit-sam @martinwork

Looks like we can safely close this issue off now?

microbit-sam commented 6 years ago

Yep, Martin's fixed these for me :)