janjongboom / janpatch

JojoDiff Alternative Patch library - portable C library for memory-efficient binary patching
Other
133 stars 24 forks source link

Question Regarding janpatch? #17

Closed yogeshk19 closed 3 years ago

yogeshk19 commented 3 years ago

Hello Jan,

I was wondering do I just need to include the janpatch.h in my mbed-os 5 application and then figure a way to use your block device example? In most of your example projects that use janpatch, it uses janpatch.lib. Is this a compiled version of some additional files including janpatch.h or does it contain just janpatch.h?

It will be great if you can clarify this, so I can continue to try and see if we can leverage this for our lorawan application we have built so far.

Thanks, Yogesh

janjongboom commented 3 years ago

Hi Yogesh, janpatch.lib is the Mbed OS library format, it just links to this repo, there's nothing compiled in there. You can just copy-paste the header in your project and be done with it.

yogeshk19 commented 3 years ago

Thanks Jan for taking the time to respond. Just curious from the previous issue you made it clear, you haven't been supporting this repository. However I was wondering for the lorawan FOTA demo's you have been doing on the things network forum which I had seen in youtube, were you using this version of janpatch code to demonstrate transferring the diff binary over lora and assembling the diff binary back on the xDot or other lora modules? We want to be able to do the same, since we have production version of our lorawan implementations in remote areas and FOTA transfers is the way we want to deploy our firmware's in the future, so could we use the current version of janpatch to be able to achieve that and to assemble the diff binary on our mdot's deployed in the field?

Thanks, Yogesh

janjongboom commented 3 years ago

@yogeshk19 Yep, this exact repo. Runs on virtually anything, and as far as I know the implementation was correct (and used in the field by some people including Intel) as of a few months ago (JojoDiff has been updated since, but as long as you use jdiff.js as linked in the README of this repo you should be fine).

yogeshk19 commented 3 years ago

@janjongboom Thanks so much for confirming. Just curious on your thoughts regarding programming on flashes that have let's say about quirks about programing the flash. For ex: some flash require the size of the data you programing on the flash to be multiples of word length and that way you can program on word aligned addresses. For ex: on NRF52840 BLE Module it has an internal flash of 1 MB and our current bootloader size is about 20kb and our application is about 200kb since we are using no RTOS and using the nano lib we can further reduce this overall firmware size. My questions is how would JANPATCH deal with these scenario where you can only program the flash in a certain way. Currently we flash over the serial port and so I ensure that the firmware when flashed in word boundaries and also the erase page size for this flash is 4k. I was using your Block Device example to see how we can build around flashing on the internal flash, put when it comes to programming I am stuck in this dilemma of ensuring the word boundaries with JANPATCH.

Thanks, Yogesh

janjongboom commented 3 years ago

Hi @yogeshk19 Sorry for the late reply, was not checking my GH activity tab. For aligned reads/writes I've used a wrapper which pages flash pages in / out, like this one https://github.com/janjongboom/mbed-lorawan-update-client/blob/master/fragmentation/source/FragmentationBlockDeviceWrapper.cpp. It allocates a page buffer then loads the right page / saves the right page whenever a page boundary is crossed.

janjongboom commented 3 years ago

Hi @yogeshk19 Sorry for the late reply, was not checking my GH activity tab. For aligned reads/writes I've used a wrapper which pages flash pages in / out, like this one https://github.com/janjongboom/mbed-lorawan-update-client/blob/master/fragmentation/source/FragmentationBlockDeviceWrapper.cpp.