Skip to content
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

Update bootloader.c #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

lucashutchinson
Copy link

fix max packet size bug

fix max packet size bug
Copy link
Owner

@glegrain glegrain left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for contributing. The 256 nob limitation is a know issue and would be nice to fix.

Let's review the changes together to implement a clean solution.

Please update README.md as well.

@@ -135,7 +135,7 @@ void BL_ReadMemory_Command(uint32_t address, uint8_t nob, uint8_t *pData)
uint8_t addr_frame[5];
uint8_t nob_frame[2];
uint8_t dummy = 0x00U;

uint16_t nobrx = nob+1;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would be easier to understand from an API point of view if the nob parameter was the number of Bytes to be read and not nob-1. What about changing the nob parameter to a uint16_t instead?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes - agreed - it would be easier to understand and the fact that the bootloader uses nob - 1 internally can be hidden away as implementation detail

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cool

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just need to check for the case when user sends nob = 0 and return

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For now, I think we can just prematurely exit the function if nob == 0. Later on, we should return something like BL_ERROR

@@ -212,8 +212,9 @@ void BL_WriteMemory_Command(uint32_t address, uint8_t nob, uint8_t *pData)
{
uint8_t cmd_frame[3];
uint8_t addr_frame[5];
uint8_t n = nob - 1U;
uint8_t checksum = xor_checksum(pData, nob) ^ n;
uint8_t n = nob;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same, uint16_t for nob parameter

@@ -440,14 +441,15 @@ static void wait_for_ack(void)
}
}

static uint8_t xor_checksum(const uint8_t pData[], uint8_t len)
static uint8_t xor_checksum(const uint8_t pData[], uint16_t len)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@kaushaleinfo
Copy link

how to send one hex file to another stm32 board here you are send dummy data but i want to send hex file

@atsju
Copy link

atsju commented Nov 17, 2021

how to send one hex file to another stm32 board here you are send dummy data but i want to send hex file

@kaushaleinfo You shall ask this in "issues" tab not in a pull request.

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.

5 participants