summaryrefslogtreecommitdiffstats
path: root/firmware/bootloaderconfig.h
diff options
context:
space:
mode:
authorcpldcpu <cpldcpu@gmail.com>2013-10-07 01:05:23 +0200
committercpldcpu <cpldcpu@gmail.com>2013-10-07 01:05:23 +0200
commitbfc82adaf601462b5bb27afd20d5f655f5537146 (patch)
tree17e9712d4bfcdbeba167cd27ca61fc2f08175ccb /firmware/bootloaderconfig.h
parenta3fdc6f10b89ef806e2f4744f3f5de667c0df84f (diff)
downloadmicronucleus-bfc82adaf601462b5bb27afd20d5f655f5537146.tar.gz
micronucleus-bfc82adaf601462b5bb27afd20d5f655f5537146.tar.bz2
micronucleus-bfc82adaf601462b5bb27afd20d5f655f5537146.zip
Do modulo only on lower byte - saves 24 bytes
GCC generated some quite weird code from the module operations. Although highly optimized, most of the instructions are redundant. Is this a bug? The current solution is a bit hacky, but should also work when the pages size is changed in future devices. uchar isLast = (((currentAddress&0xff) % SPM_PAGESIZE) == 0); 1e02: 80 91 69 00 lds r24, 0x0069 1e06: 90 91 6a 00 lds r25, 0x006A 1e0a: 8f 73 andi r24, 0x3F ; 63 1e0c: 99 27 eor r25, r25 // definitely need this if! seems usbFunctionWrite gets called again in future usbPoll's in the runloop! if (isLast) fireEvent(EVENT_WRITE_PAGE); // ask runloop to write our page 1e0e: 89 2b or r24, r25 1e10: 39 f0 breq .+14 ; 0x1e20 <main+0x1ee> 1e12: 0d c0 rjmp .+26 ; 0x1e2e <main+0x1fc>
Diffstat (limited to 'firmware/bootloaderconfig.h')
0 files changed, 0 insertions, 0 deletions