MyUSB Update
As an update to my last entry; no, it didn’t work. Specifically, the SYS assignment worked just fine, but a small algorithmic bug in the Java assignment saw me loose the greater portion of the marks. Unfortunately my marker decided that the rest of the operation, although correct in the context of the algorithmic mistake, was not valid for marks, so I’ve managed to only scrape by in the execution test. Oh well, win some, loose some, at least I know what I’m doing and I’ll pass the Java exam with no trouble at all.
Now, back to MyUSB. After toying around with the new event system I was working on, I’ve incorporated it into the main code (on the MyUSB project page) and updated the wiki documentation accordingly. It’s very nice to work with now – all event hooks are done transparently through some GCC attribute magic, which also allows for old event names to be deprecated. The new system is a lot cleaner than the old configuration header file full of hook defines, and so will make updating a project’s MyUSB library code a lot easier in the future.
An interesting side effect is that the resulting binary code decreased slightly. I haven’t analyzed why this is the case, but I would have thought adding in function calls and returns rather than inline code would have bloated rather than reduced the code size. I can only speculate that the use of proper functions freed up enough registers or gave the compiler enough room to make some better compile optimizations. Whatever the reason may be, I’m one happy chappy, so to speak.
Another advancement was the addition of switches in the makefile to enable unused function garbage collecting (found in this thread) which may prove useful in the future, as well as linker relaxations (good discussion here). The latter is a great find – it causes the linked functions to use the smaller RCALL assembly opcode rather than the larger CALL opcode where possible when calling other functions. That alone resulted in fantastic code space savings.

Loading...