WellDone / MoMo-Firmware

Embedded PIC Firmware and hardware designs for the WellDone Mobile Monitor (MoMo).
welldone.org
Other
8 stars 6 forks source link

CRITICAL: Fix bootloader not writing last 32 bytes of ROM sometimes. #173

Closed timburke closed 9 years ago

timburke commented 9 years ago

Due to a terrible bug in the bootloading code of the pic12_executive, it will sometimes not write the last 32 bytes of ROM on pic 16lf1847 chips. This is because it has to fetch the ROM in 2 calls since the rows are 32 bytes wide on this chip. The bootloader checks to see if each half page is defined in the controller firmware_cache and if either half-page is not defined it does not program the entire page. To hit this bug you would need to have a firmware with length longer than 2k because otherwise the entire last page would always be filled by the mib block. You also need to end on an address that it >= 0 but less than 16 so that you touch another page but don't touch the high half-page.

The fix is to change the check for valid pages so that if either half-page is valid, the entire page is written. Turns out the gsm module code (with my changes, not sure about before but probably) was sometimes falling into this regime and having the string constants replaced by 0xFF (the unprogrammed ROM value).

Actions

amcgee commented 9 years ago

Good catch.

timburke commented 9 years ago

He who writes the bug must at some point become he who fixes the bug?

On 2/2/15 10:35 AM, Austin McGee wrote:

Good catch.

— Reply to this email directly or view it on GitHub https://github.com/WellDone/MoMo-Firmware/pull/173#issuecomment-72511203.

amcgee commented 9 years ago

arr