Merge pull request #551 from dhalbert/3.0_double_word_stack_align

3.0 double word stack align
This commit is contained in:
Scott Shawcroft 2018-01-24 18:27:22 -08:00 committed by GitHub
commit a1254f1255
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 21 additions and 13 deletions

View File

@ -144,7 +144,7 @@ STATIC mp_obj_t re_split(size_t n_args, const mp_obj_t *args) {
}
mp_obj_t retval = mp_obj_new_list(0, NULL);
const char* caps[caps_num];
const char **caps = alloca(caps_num * sizeof(char*));
while (true) {
// cast is a workaround for a bug in msvc: it treats const char** as a const pointer instead of a pointer to pointer to const char
memset((char**)caps, 0, caps_num * sizeof(char*));

View File

@ -11,7 +11,8 @@ MEMORY
}
/* top end of the stack */
_estack = ORIGIN(RAM) + LENGTH(RAM) - 4;
/* stack must be double-word (8 byte) aligned */
_estack = ORIGIN(RAM) + LENGTH(RAM) - 8;
_bootloader_dbl_tap = _estack;
/* define output sections */

View File

@ -11,7 +11,8 @@ MEMORY
}
/* top end of the stack */
_estack = ORIGIN(RAM) + LENGTH(RAM) - 4;
/* stack must be double-word (8 byte) aligned */
_estack = ORIGIN(RAM) + LENGTH(RAM) - 8;
_bootloader_dbl_tap = _estack;
/* define output sections */

View File

@ -10,7 +10,8 @@ MEMORY
}
/* top end of the stack */
_estack = ORIGIN(RAM) + LENGTH(RAM) - 4;
/* stack must be double-word (8 byte) aligned */
_estack = ORIGIN(RAM) + LENGTH(RAM) - 8;
_bootloader_dbl_tap = _estack;
/* define output sections */

View File

@ -11,7 +11,8 @@ MEMORY
}
/* top end of the stack */
_estack = ORIGIN(RAM) + LENGTH(RAM) - 4;
/* stack must be double-word (8 byte) aligned */
_estack = ORIGIN(RAM) + LENGTH(RAM) - 8;
_bootloader_dbl_tap = _estack;
/* define output sections */

View File

@ -10,7 +10,8 @@ MEMORY
}
/* top end of the stack */
_estack = ORIGIN(RAM) + LENGTH(RAM) - 4;
/* stack must be double-word (8 byte) aligned */
_estack = ORIGIN(RAM) + LENGTH(RAM) - 8;
_bootloader_dbl_tap = _estack;
/* define output sections */

View File

@ -10,7 +10,8 @@ MEMORY
}
/* top end of the stack */
_estack = ORIGIN(RAM) + LENGTH(RAM) - 4;
/* stack must be double-word (8 byte) aligned */
_estack = ORIGIN(RAM) + LENGTH(RAM) - 8;
_bootloader_dbl_tap = _estack;
/* define output sections */

View File

@ -10,7 +10,8 @@ MEMORY
}
/* top end of the stack */
_estack = ORIGIN(RAM) + LENGTH(RAM) - 4;
/* stack must be double-word (8 byte) aligned */
_estack = ORIGIN(RAM) + LENGTH(RAM) - 8;
_bootloader_dbl_tap = _estack;
/* define output sections */

View File

@ -10,7 +10,8 @@ MEMORY
}
/* top end of the stack */
_estack = ORIGIN(RAM) + LENGTH(RAM) - 4;
/* stack must be double-word (8 byte) aligned */
_estack = ORIGIN(RAM) + LENGTH(RAM) - 8;
_bootloader_dbl_tap = _estack;
/* define output sections */

View File

@ -10,7 +10,8 @@ MEMORY
}
/* top end of the stack */
_estack = ORIGIN(RAM) + LENGTH(RAM) - 4;
/* stack must be double-word (8 byte) aligned */
_estack = ORIGIN(RAM) + LENGTH(RAM) - 8;
_bootloader_dbl_tap = _estack;
/* define output sections */

View File

@ -1428,10 +1428,9 @@ import_error:
mp_load_method_maybe(module, MP_QSTR___name__, dest);
size_t pkg_name_len;
const char *pkg_name = mp_obj_str_get_data(dest[0], &pkg_name_len);
const uint dot_name_len = pkg_name_len + 1 + qstr_len(name);
// Previously dot_name was created using alloca(), but that caused run-time crashes on M4 due to
// stack corruption (compiler bug, it appears), so use an array instead.
char dot_name[dot_name_len];
char *dot_name = alloca(dot_name_len);
memcpy(dot_name, pkg_name, pkg_name_len);
dot_name[pkg_name_len] = '.';
memcpy(dot_name + pkg_name_len + 1, qstr_str(name), qstr_len(name));