Skip to content

Fix alignment warning #2618

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 3 commits into from
Feb 18, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions ports/mimxrt10xx/common-hal/microcontroller/Processor.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,13 @@ void common_hal_mcu_processor_get_uid(uint8_t raw_id[]) {
OCOTP_Init(OCOTP, CLOCK_GetFreq(kCLOCK_IpgClk));

// Reads shadow registers 0x01 - 0x04 (Configuration and Manufacturing Info)
for (int i = 0; i < 4; ++i)
((uint32_t*) raw_id)[i] = OCOTP_ReadFuseShadowRegister(OCOTP, i + 1);

// into 8 bit wide destination, avoiding punning.
for (int i = 0; i < 4; ++i) {
uint32_t wr = OCOTP_ReadFuseShadowRegister(OCOTP, i + 1);
for (int j = 0; j < 4; j++) {
raw_id[i*4+j] = wr & 0xff;
wr >>= 8;
}
}
OCOTP_Deinit(OCOTP);
}