-
Notifications
You must be signed in to change notification settings - Fork 7
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
base: master
Are you sure you want to change the base?
Conversation
fix max packet size bug
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.
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; |
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.
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?
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.
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
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.
cool
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.
just need to check for the case when user sends nob = 0 and return
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.
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; |
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.
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) |
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.
👍
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. |
fix max packet size bug