Skip to content

Commit eea5fcc

Browse files
committed
stm32/make-stmconst.py: Make sure mpz const data lives in ROM.
1 parent 6e06512 commit eea5fcc

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

ports/stm32/make-stmconst.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
"""
2-
Read in the cmsis/devinc/stm32f405xx.h header, extract relevant constants,
3-
and create modstmconst.c.
4-
5-
This is not part of the automatic build process because stm32f405xx.h isn't
6-
expected to change. After generating the file, some manual intervention is
7-
needed to copy the new qstr definitions to qstrdefsport.h.
2+
This script reads in the given CMSIS device include file (eg stm32f405xx.h),
3+
extracts relevant peripheral constants, and creates qstrs, mpz's and constants
4+
for the stm module.
85
"""
96

107
from __future__ import print_function
@@ -254,7 +251,7 @@ def main():
254251
for mpz in sorted(needed_mpzs):
255252
assert 0 <= mpz <= 0xffffffff
256253
print('STATIC const mp_obj_int_t mpz_%08x = {{&mp_type_int}, '
257-
'{.neg=0, .fixed_dig=1, .alloc=2, .len=2, ' '.dig=(uint16_t[]){%#x, %#x}}};'
254+
'{.neg=0, .fixed_dig=1, .alloc=2, .len=2, ' '.dig=(uint16_t*)(const uint16_t[]){%#x, %#x}}};'
258255
% (mpz, mpz & 0xffff, (mpz >> 16) & 0xffff), file=mpz_file)
259256

260257
if __name__ == "__main__":

0 commit comments

Comments
 (0)