stm32/make-stmconst.py: Make sure mpz const data lives in ROM.

This commit is contained in:
Damien George 2017-09-12 15:31:43 +10:00
parent 6e06512e0f
commit eea5fcc442

View File

@ -1,10 +1,7 @@
""" """
Read in the cmsis/devinc/stm32f405xx.h header, extract relevant constants, This script reads in the given CMSIS device include file (eg stm32f405xx.h),
and create modstmconst.c. extracts relevant peripheral constants, and creates qstrs, mpz's and constants
for the stm module.
This is not part of the automatic build process because stm32f405xx.h isn't
expected to change. After generating the file, some manual intervention is
needed to copy the new qstr definitions to qstrdefsport.h.
""" """
from __future__ import print_function from __future__ import print_function
@ -254,7 +251,7 @@ def main():
for mpz in sorted(needed_mpzs): for mpz in sorted(needed_mpzs):
assert 0 <= mpz <= 0xffffffff assert 0 <= mpz <= 0xffffffff
print('STATIC const mp_obj_int_t mpz_%08x = {{&mp_type_int}, ' print('STATIC const mp_obj_int_t mpz_%08x = {{&mp_type_int}, '
'{.neg=0, .fixed_dig=1, .alloc=2, .len=2, ' '.dig=(uint16_t[]){%#x, %#x}}};' '{.neg=0, .fixed_dig=1, .alloc=2, .len=2, ' '.dig=(uint16_t*)(const uint16_t[]){%#x, %#x}}};'
% (mpz, mpz & 0xffff, (mpz >> 16) & 0xffff), file=mpz_file) % (mpz, mpz & 0xffff, (mpz >> 16) & 0xffff), file=mpz_file)
if __name__ == "__main__": if __name__ == "__main__":