Skip to content

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

Merged
merged 4 commits into from
Apr 23, 2014

Conversation

Gregwar
Copy link
Contributor

@Gregwar Gregwar commented Apr 22, 2014

This fixes warnings and volatile variables, making the booloader working with -Os
Before this change, the bootloader was not able to upload any data with optimization enabled

This takes the bootloader size from ~16k to ~7k

@Gregwar Gregwar changed the title Dfu fix Fixing dfu.c to allow compiling with -Os Apr 22, 2014
@@ -330,7 +330,7 @@ u8 *dfuCopyStatus(u16 length) {
pInformation->Ctrl_Info.Usb_wLength = 6;
return NULL;
} else {
return(&dfuAppStatus);
return (u8*)(&dfuAppStatus);
Copy link
Contributor

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_?

Copy link
Contributor Author

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

@Gregwar
Copy link
Contributor Author

Gregwar commented Apr 23, 2014

BTW, is it safe to change USER_CODE_FLASH, to lower value?
My build of the bootloader is about 7k, I could set it to 0x8002000 for instance
Why is it 0x8005000 now, 20K is really big compared with the bootloader size, it isn't?

@mbolivar
Copy link
Contributor

Your'e right, it's too large, but we're stuck with that as a default
value since boards we've already sold have bootloaders that jump there.

It's OK to change it, but you need to make similar changes to
VECT_TAB_FLASH in the libmaple build system.

On 04/23/2014 05:00 AM, Grégoire Passault wrote:

BTW, is it safe to change |USER_CODE_FLASH|, to lower value?
My build of the bootloader is about 7k, I could set it to |0x8002000|
for instance
Why is it |0x8005000| now, 20K is really big compared with the
bootloader size, it isn't?


Reply to this email directly or view it on GitHub
#9 (comment).

@mbolivar
Copy link
Contributor

Looks good to me. Thanks for submitting this!

mbolivar pushed a commit that referenced this pull request Apr 23, 2014
Fixing dfu.c to allow compiling with -Os
@mbolivar mbolivar merged commit 5f09352 into leaflabs:master Apr 23, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants