Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
micropython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
xpstem
micropython
Commits
2f4aca03
Commit
2f4aca03
authored
May 30, 2022
by
Jared Hancock
Committed by
Damien George
Jun 02, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mimxrt/mphalport: Fix strict aliasing error with unique id.
parent
6bda80d8
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
6 deletions
+6
-6
ports/mimxrt/mphalport.c
ports/mimxrt/mphalport.c
+6
-6
No files found.
ports/mimxrt/mphalport.c
View file @
2f4aca03
...
...
@@ -140,8 +140,8 @@ uint64_t mp_hal_time_ns(void) {
// MAC address
void
mp_hal_get_unique_id
(
uint8_t
id
[])
{
*
(
uint32_t
*
)
&
id
[
0
]
=
OCOTP
->
CFG0
;
*
(
uint32_t
*
)
&
id
[
4
]
=
OCOTP
->
CFG1
;
*
(
uint32_t
*
)
id
=
OCOTP
->
CFG0
;
*
(
uint32_t
*
)
(
id
+
4
)
=
OCOTP
->
CFG1
;
}
// Generate a random locally administered MAC address (LAA)
...
...
@@ -150,12 +150,12 @@ void mp_hal_generate_laa_mac(int idx, uint8_t buf[6]) {
unsigned
char
id
[
8
];
mp_hal_get_unique_id
(
id
);
uint32_t
pt1
=
*
(
uint32_t
*
)
&
id
[
0
]
;
uint32_t
pt2
=
*
(
uint32_t
*
)
&
id
[
4
]
;
uint32_t
*
pt1
=
(
uint32_t
*
)
id
;
uint32_t
*
pt2
=
(
uint32_t
*
)(
id
+
4
)
;
buf
[
0
]
=
0x02
;
// Locally Administered MAC
*
(
uint32_t
*
)
&
buf
[
1
]
=
pt1
^
(
pt1
>>
8
);
*
(
uint16_t
*
)
&
buf
[
4
]
=
(
uint16_t
)(
pt2
^
pt2
>>
16
);
*
(
uint32_t
*
)
&
buf
[
1
]
=
*
pt1
^
(
*
pt1
>>
8
);
*
(
uint16_t
*
)
&
buf
[
4
]
=
(
uint16_t
)(
*
pt2
^
*
pt2
>>
16
);
buf
[
5
]
^=
(
uint8_t
)
idx
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment