2011/5/6 William <[email protected]> > Hi Seb, > > On May 6, 11:43 am, Sebastien Lelong <[email protected]> > wrote: > > > > in order to avoid duplication of code, > > we refactored the setting mode code into an other procedure, while > calling > > it within new init procedure. > > > > So far as I can determine, this is the very first time you actually > explained why you rewrote spi_init() -- 'to avoid duplication of > code'.
No. Previously I said: > => (1) direct access to device file register (2) duplication of code as it's > already done in spi lib. Two reasons why we changed this into: If there wasn't some duplication of code, it wouldn't be a refactoring... > But does it really? I may look more pleasing (to you) in the > source file, but had you left it as the original, I would be much > happier. So, does your happiness avoid duplication of code ? Really, I'm reading your sentence again and again, I don't see your point... > And I wonder how much, if any, your version saves actual > code space in flash? Remember you must include the overhead of > calling/returning the new function, unless you decide to inline it. > As expected, it doesn't change anything regarding resource usage with sample sample/16f819_canopen_mcp2515_txhb.jal: r2585 ./compiler/jalv24o -s include/device/\;include/peripheral/spi/\;include/external/can/\;include/jal\;include/protocol sample/16f819_canopen_mcp2515_txhb.jal jal 2.4o (compiled Mar 6 2011) generating p-code 301 tokens, 80113 chars; 2233 lines; 8 files generating PIC code pass 1 generating PIC code pass 2 writing result Code area: 663 of 2048 used (words) Data area: 93 of 240 used Software stack available: 80 bytes Hardware stack depth 5 of 8 0 errors, 0 warnings HEAD: ./compiler/jalv24o -s include/device/\;include/peripheral/spi/\;include/external/can/\;include/jal\;include/protocol sample/16f819_canopen_mcp2515_txhb.jal jal 2.4o (compiled Mar 6 2011) generating p-code 301 tokens, 80412 chars; 2245 lines; 8 files generating PIC code pass 1 generating PIC code pass 2 writing result Code area: 663 of 2048 used (words) Data area: 93 of 240 used Software stack available: 80 bytes Hardware stack depth 5 of 8 0 errors, 0 warnings As expected, it saves few bytes of memory with sd_card sample: r2585 ./compiler/jalv24o -s include/peripheral/usart\;include/device/\;include/peripheral/spi/\;include/external/can/\;include/jal\;include/protocol\;include/external/storage/sd_card sample/16f877_sd_card.jal jal 2.4o (compiled Mar 6 2011) generating p-code 4563 tokens, 152079 chars; 4025 lines; 11 files generating PIC code pass 1 generating PIC code pass 2 writing result Code area: 971 of 8192 used (words) Data area: 65 of 352 used Software stack available: 96 bytes Hardware stack depth 6 of 8 0 errors, 0 warnings HEAD ./compiler/jalv24o -s include/peripheral/usart\;include/device/\;include/peripheral/spi/\;include/external/can/\;include/jal\;include/protocol\;include/external/storage/sd_card sample/16f877_sd_card.jal jal 2.4o (compiled Mar 6 2011) generating p-code 4595 tokens, 152908 chars; 4043 lines; 12 files generating PIC code pass 1 generating PIC code pass 2 writing result Code area: 954 of 8192 used (words) Data area: 67 of 352 used Software stack available: 96 bytes Hardware stack depth 6 of 8 0 errors, 0 warnings Cheers, Seb -- You received this message because you are subscribed to the Google Groups "jallib" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/jallib?hl=en.
