-
Notifications
You must be signed in to change notification settings - Fork 118
Fixing dfu.c to allow compiling with -Os #9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,19 +35,19 @@ | |
#include "usb.h" | ||
|
||
/* DFU globals */ | ||
u32 userAppAddr = USER_CODE_RAM; /* default RAM user code location */ | ||
u32 userAppEnd = RAM_END; | ||
DFUStatus dfuAppStatus; /* includes state */ | ||
bool userFlash = FALSE; | ||
bool dfuBusy = FALSE; | ||
static volatile u32 userAppAddr = USER_CODE_RAM; /* default RAM user code location */ | ||
static volatile u32 userAppEnd = RAM_END; | ||
static volatile DFUStatus dfuAppStatus; /* includes state */ | ||
static volatile bool userFlash = FALSE; | ||
volatile bool dfuBusy = FALSE; | ||
|
||
u8 recvBuffer[wTransferSize]; | ||
u32 userFirmwareLen = 0; | ||
u16 thisBlockLen = 0; | ||
u16 uploadBlockLen = 0; | ||
static volatile u8 recvBuffer[wTransferSize] __attribute__((aligned(4))); | ||
static volatile u32 userFirmwareLen = 0; | ||
static volatile u16 thisBlockLen = 0; | ||
static volatile u16 uploadBlockLen = 0; | ||
|
||
|
||
PLOT code_copy_lock; | ||
volatile PLOT code_copy_lock; | ||
|
||
/* todo: force dfu globals to be singleton to avoid re-inits? */ | ||
void dfuInit(void) { | ||
|
@@ -330,7 +330,7 @@ u8 *dfuCopyStatus(u16 length) { | |
pInformation->Ctrl_Info.Usb_wLength = 6; | ||
return NULL; | ||
} else { | ||
return(&dfuAppStatus); | ||
return (u8*)(&dfuAppStatus); | ||
} | ||
} | ||
|
||
|
@@ -371,7 +371,7 @@ void dfuCopyBufferToExec() { | |
flashErasePage((u32)(userSpace)); | ||
|
||
for (i = 0; i < thisBlockLen; i = i + 4) { | ||
flashWriteWord(userSpace++, *(u32 *)(recvBuffer + i)); | ||
flashWriteWord((u32)(userSpace++), *(u32 *)(recvBuffer +i)); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The built-in unaligned access support will make this work, but can you please add an There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok, it's done |
||
} | ||
|
||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there some reason why you cast to u8_, instead of DFUStatus_?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is because it's the return type of the method