microsoft / uf2-samdx1

USB Mass Storage bootloader (based on UF2) for SAMD21 and SAMD51
Other
243 stars 300 forks source link

purpose of flash_write() function in flash_samd21.c? #90

Closed dhalbert closed 4 years ago

dhalbert commented 4 years ago

Hi, I'm trying to gain back some space in the samd21 version of the bootloader to eventually add fuse repair and other features.

Could I ask, what is the purpose of this flash_write() function? https://github.com/microsoft/uf2-samdx1/blob/df89a1f91a7464a51cd11cb3ad7ca10051028bc4/src/flash_samd21.c#L62 It's not used in C code but is mentioned in the Makefile: https://github.com/microsoft/uf2-samdx1/blob/df89a1f91a7464a51cd11cb3ad7ca10051028bc4/Makefile#L197-L198

A samd51 version of this function was never written.

If its purpose has passed, it could be removed to reclaim some space. Thanks.

mmoskal commented 4 years ago

It was used to generate assembly stub to be uploaded via debugger to flash on device. While you can remove it, it will not save space. We compile with -ffunction-sections (wasn't you who added that? ;-) so functions that are not used are not compiled in.

dhalbert commented 4 years ago

Ah, ok, thanks!