Skip to content

Commit e138b02

Browse files
committed
main: Allow these arrays to reside in ROM
The missing second "const" made these mutable arrays pointing to const string data.
1 parent f65d1a0 commit e138b02

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

main.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ void stop_mp(void) {
181181

182182
// Look for the first file that exists in the list of filenames, using mp_import_stat().
183183
// Return its index. If no file found, return -1.
184-
const char* first_existing_file_in_list(const char ** filenames) {
184+
const char* first_existing_file_in_list(const char * const * filenames) {
185185
for (int i = 0; filenames[i] != (char*)""; i++) {
186186
mp_import_stat_t stat = mp_import_stat(filenames[i]);
187187
if (stat == MP_IMPORT_STAT_FILE) {
@@ -191,7 +191,7 @@ const char* first_existing_file_in_list(const char ** filenames) {
191191
return NULL;
192192
}
193193

194-
bool maybe_run_list(const char ** filenames, pyexec_result_t* exec_result) {
194+
bool maybe_run_list(const char * const * filenames, pyexec_result_t* exec_result) {
195195
const char* filename = first_existing_file_in_list(filenames);
196196
if (filename == NULL) {
197197
return false;
@@ -256,9 +256,9 @@ bool run_code_py(safe_mode_t safe_mode) {
256256
} else {
257257
new_status_color(MAIN_RUNNING);
258258

259-
static const char *supported_filenames[] = STRING_LIST("code.txt", "code.py", "main.py", "main.txt");
259+
static const char * const supported_filenames[] = STRING_LIST("code.txt", "code.py", "main.py", "main.txt");
260260
#if CIRCUITPY_FULL_BUILD
261-
static const char *double_extension_filenames[] = STRING_LIST("code.txt.py", "code.py.txt", "code.txt.txt","code.py.py",
261+
static const char * const double_extension_filenames[] = STRING_LIST("code.txt.py", "code.py.txt", "code.txt.txt","code.py.py",
262262
"main.txt.py", "main.py.txt", "main.txt.txt","main.py.py");
263263
#endif
264264

@@ -343,7 +343,7 @@ void __attribute__ ((noinline)) run_boot_py(safe_mode_t safe_mode) {
343343
// If not in safe mode, run boot before initing USB and capture output in a
344344
// file.
345345
if (filesystem_present() && safe_mode == NO_SAFE_MODE && MP_STATE_VM(vfs_mount_table) != NULL) {
346-
static const char *boot_py_filenames[] = STRING_LIST("settings.txt", "settings.py", "boot.py", "boot.txt");
346+
static const char * const boot_py_filenames[] = STRING_LIST("settings.txt", "settings.py", "boot.py", "boot.txt");
347347

348348
new_status_color(BOOT_RUNNING);
349349

0 commit comments

Comments
 (0)