Skip to content

examples/modx: Make the modx example work with the Cortex M0 - #2

Merged
dpgeorge merged 2 commits into
dpgeorge:dynamic-native-modules-v2from
aykevl:dyn-nat-cortex-m0
Oct 24, 2017
Merged

dpgeorge merged 2 commits into
dpgeorge:dynamic-native-modules-v2from
aykevl:dyn-nat-cortex-m0

Conversation

@aykevl

@aykevl aykevl commented Oct 16, 2017

Copy link
Copy Markdown

This was needed to get it to work on a Cortex M0 (nRF51822).
I've also made the Makefile a bit more flexible.

e.g.

make CROSS=arm-cortex-m0

@dpgeorge

Copy link
Copy Markdown
Owner

Since one will always be "cross compiling" for some target architecture I think it makes more sense to call the variable ARCH and make the valid values match the MP_PERSISTENT_ARCH constants. Eg: make ARCH=thumb2. And then it would always use the $ARCH variable to make the build directory's name.

Also, I think M0 and M4 should have separate MP_PERSISTENT_ARCH constants, because M4 code won't run on M0.

@aykevl
aykevl force-pushed the dyn-nat-cortex-m0 branch from 34ebbab to f87506b Compare October 17, 2017 22:53
@aykevl

aykevl commented Oct 17, 2017

Copy link
Copy Markdown
Author

I've updated the pull request.

I'm not so sure about the naming. I've changed thumb2 to m0 and m4. But the architecture itself is something else - ARM 6M or ARM 7EM (or ARM 7M for the Cortex M3), so it could also be e.g. arm-6m for the M0. But using M0 etc. seems more obvious to me.

Also, maybe M4 is the wrong name here - it includes floating point support so it should maybe be called M4F (see: https://en.wikipedia.org/wiki/ARM_Cortex-M#Instruction_sets).

@dpgeorge
dpgeorge merged commit b7efae3 into dpgeorge:dynamic-native-modules-v2 Oct 24, 2017
@dpgeorge

Copy link
Copy Markdown
Owner

Thanks for updating.

I also agree that the thumb naming needs a bit more refining. Note there is also M7 with extra instructions (like double precision fp) so at least that needs to be added. But all this can be done later. Merged in b7efae3

@aykevl
aykevl deleted the dyn-nat-cortex-m0 branch October 24, 2017 19:26
dpgeorge pushed a commit that referenced this pull request May 30, 2021
asan considers that memcmp(p, q, N) is permitted to access N bytes at each
of p and q, even for values of p and q that have a difference earlier.
Accessing additional values is frequently done in practice, reading 4 or
more bytes from each input at a time for efficiency, so when completing
"non_exist<TAB>" in the repl, this causes a diagnostic:

    ==16938==ERROR: AddressSanitizer: global-buffer-overflow on
    address 0x555555cd8dc8 at pc 0x7ffff726457b bp 0x7fffffffda20 sp 0x7fff
    READ of size 9 at 0x555555cd8dc8 thread T0
        #0 0x7ffff726457a  (/usr/lib/x86_64-linux-gnu/libasan.so.5+0xb857a)
        #1 0x555555b0e82a in mp_repl_autocomplete ../../py/repl.c:301
        #2 0x555555c89585 in readline_process_char ../../lib/mp-readline/re
        #3 0x555555c8ac6e in readline ../../lib/mp-readline/readline.c:513
        #4 0x555555b8dcbd in do_repl /home/jepler/src/micropython/ports/uni
        #5 0x555555b90859 in main_ /home/jepler/src/micropython/ports/unix/
        #6 0x555555b90a3a in main /home/jepler/src/micropython/ports/unix/m
        #7 0x7ffff619a09a in __libc_start_main ../csu/libc-start.c:308
        #8 0x55555595fd69 in _start (/home/jepler/src/micropython/ports/uni

    0x555555cd8dc8 is located 0 bytes to the right of global variable
    'import_str' defined in '../../py/repl.c:285:23' (0x555555cd8dc0) of
    size 8
      'import_str' is ascii string 'import '

Signed-off-by: Jeff Epler <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants