diff options
author | cpldcpu <cpldcpu@gmail.com> | 2015-01-12 00:46:06 +0100 |
---|---|---|
committer | cpldcpu <cpldcpu@gmail.com> | 2015-01-12 00:46:06 +0100 |
commit | 42f2d8cc38064c67a9478826f563f5110c3848ee (patch) | |
tree | 2add26052b2d424d9efaa5848b654b16f0e3d4cf /firmware/main.c | |
parent | 80419704f68bf0783c5de63a6a4b9d89b45235c7 (diff) | |
download | micronucleus-42f2d8cc38064c67a9478826f563f5110c3848ee.tar.gz micronucleus-42f2d8cc38064c67a9478826f563f5110c3848ee.tar.bz2 micronucleus-42f2d8cc38064c67a9478826f563f5110c3848ee.zip |
#ENABLE_UNSAFE_OPTIMIZATIONS
Added new global flag to enable unsafe optimizations:
This will disable several safety features in microncleus to save around
40 more bytes
Disabled features:
* Stack pointer and SREG initialization in CRT
* Client side reset vector patching
* USB collision detection. Micronucleus will not work reliability with
hubs if this is disabled.
See t85_aggressive configuration for usage examples.
Diffstat (limited to 'firmware/main.c')
-rw-r--r-- | firmware/main.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/firmware/main.c b/firmware/main.c index 194156c..0cd0d26 100644 --- a/firmware/main.c +++ b/firmware/main.c @@ -131,19 +131,21 @@ static inline void writeFlashPage(void) { // the device can not be bricked. Saving user-reset-vector is done in the host // tool, starting with firmware V2 static void writeWordToPageBuffer(uint16_t data) { - -#if BOOTLOADER_ADDRESS < 8192 + +#ifndef ENABLE_UNSAFE_OPTIMIZATIONS + #if BOOTLOADER_ADDRESS < 8192 // rjmp if (currentAddress.w == RESET_VECTOR_OFFSET * 2) { data = 0xC000 + (BOOTLOADER_ADDRESS/2) - 1; } -#else + #else // far jmp if (currentAddress.w == RESET_VECTOR_OFFSET * 2) { data = 0x940c; } else if (currentAddress.w == (RESET_VECTOR_OFFSET +1 ) * 2) { data = (BOOTLOADER_ADDRESS/2); } + #endif #endif #if OSCCAL_SAVE_CALIB @@ -177,7 +179,7 @@ static uint8_t usbFunctionSetup(uint8_t data[8]) { command=cmd_write_page; // ask runloop to write our page } else { // Handle cmd_erase_application and cmd_exit - command=rq->bRequest&0x3f; + command=rq->bRequest&0x3f; } return 0; } @@ -278,7 +280,7 @@ int main(void) { } } while(--fastctr); - + wdr(); // commands are only evaluated after next USB transmission or after 5 ms passed |