Skip to content

Commit

Permalink
Fix #353 (#354)
Browse files Browse the repository at this point in the history
- have to cast the pointers to `uint32_t` to make sure the compiler implements the correct math

Signed-off-by: José Simões <jose.simoes@eclo.solutions>
  • Loading branch information
josesimoes authored Jun 16, 2017
1 parent e0f05af commit d2ec557
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions targets/CMSIS-OS/ChibiOS/common/Target_BlockStorage.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,16 @@ bool BlockStorageStream_Initialize(BlockStorageStream* stream, unsigned int bloc
// set BaseAddress to the start of the region
stream->BaseAddress = &__nanoImage_start__;
// set Length to the region size
stream->Length = &__nanoImage_end__ - &__nanoImage_start__;
// need to cast the pointers to make sure the compiler implements the correct math
stream->Length = ((uint32_t)&__nanoImage_end__) - ((uint32_t)&__nanoImage_start__);
}
else if(blockUsage == StorageUsage_DEPLOYMENT)
{
// set BaseAddress to the start of the region
stream->BaseAddress = &__deployment_start__;
// set Length to the region size
stream->Length = &__deployment_end__ - &__deployment_start__;
// need to cast the pointers to make sure the compiler implements the correct math
stream->Length = ((uint32_t)&__deployment_end__) - ((uint32_t)&__deployment_start__);
}

return true;
Expand Down

0 comments on commit d2ec557

Please sign in to comment.