Skip to content

Commit 71f17b0

Browse files
committed
wip: fixing compilation
1 parent e16467d commit 71f17b0

File tree

20 files changed

+78
-63
lines changed

20 files changed

+78
-63
lines changed

extmod/vfs_fat.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -358,9 +358,9 @@ STATIC mp_obj_t fat_vfs_stat(mp_obj_t vfs_in, mp_obj_t path_in) {
358358
#if MICROPY_LONGINT_IMPL == MICROPY_LONGINT_IMPL_NONE
359359
// On non-longint builds, the number of seconds since 1970 (epoch) is too
360360
// large to fit in a smallint, so just return 31-DEC-1999 (0).
361-
mp_obj_t seconds = MP_OBJ_NEW_SMALL_INT(946684800);
361+
mp_obj_t seconds_obj = MP_OBJ_NEW_SMALL_INT(946684800);
362362
#else
363-
mp_obj_t seconds = mp_obj_new_int_from_uint(
363+
mp_obj_t seconds_obj = mp_obj_new_int_from_uint(
364364
timeutils_seconds_since_epoch(
365365
1980 + ((fno.fdate >> 9) & 0x7f),
366366
(fno.fdate >> 5) & 0x0f,
@@ -377,9 +377,10 @@ STATIC mp_obj_t fat_vfs_stat(mp_obj_t vfs_in, mp_obj_t path_in) {
377377
t->items[4] = MP_OBJ_NEW_SMALL_INT(0); // st_uid
378378
t->items[5] = MP_OBJ_NEW_SMALL_INT(0); // st_gid
379379
t->items[6] = mp_obj_new_int_from_uint(fno.fsize); // st_size
380-
t->items[7] = mp_obj_new_int_from_uint(seconds); // st_atime
381-
t->items[8] = mp_obj_new_int_from_uint(seconds); // st_mtime
382-
t->items[9] = mp_obj_new_int_from_uint(seconds); // st_ctime
380+
// CIRCUITPY-CHANGE: already converted to obj
381+
t->items[7] = seconds_obj; // st_atime
382+
t->items[8] = seconds_obj; // st_mtime
383+
t->items[9] = seconds_obj; // st_ctime
383384

384385
return MP_OBJ_FROM_PTR(t);
385386
}

ports/atmel-samd/mphalport.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@
66

77
#include <string.h>
88

9+
#include "mpconfigboard.h"
10+
#include "mphalport.h"
11+
#include "reset.h"
12+
#include "supervisor/shared/tick.h"
13+
914
#include "shared/readline/readline.h"
1015
#include "shared/runtime/interrupt_char.h"
1116
#include "py/mphal.h"
@@ -21,10 +26,6 @@
2126
#include "hal/include/hal_sleep.h"
2227
#include "sam.h"
2328

24-
#include "mpconfigboard.h"
25-
#include "mphalport.h"
26-
#include "reset.h"
27-
#include "supervisor/shared/tick.h"
2829

2930
extern uint32_t common_hal_mcu_processor_get_frequency(void);
3031

ports/espressif/common-hal/socketpool/__init__.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,3 @@
55
// SPDX-License-Identifier: MIT
66

77
#pragma once
8-
9-
#ifndef MICROPY_INCLUDED_ESPRESSIF_COMMON_HAL_SOCKETPOOL___INIT___H
10-
#define MICROPY_INCLUDED_ESPRESSIF_COMMON_HAL_SOCKETPOOL___INIT___H
11-
12-
13-
#endif // MICROPY_INCLUDED_ESPRESSIF_COMMON_HAL_SOCKETPOOL___INIT___H

py/makeqstrdata.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,8 @@ def esc_char(m):
323323
static_qstr_list_ident = list(map(qstr_escape, static_qstr_list))
324324

325325

326-
def parse_input_headers(infiles):
326+
# CIRCUITPY-CHANGE: add translations handling
327+
def parse_input_headers_with_translations(infiles):
327328
qcfgs = {}
328329
qstrs = {}
329330
# CIRCUITPY-CHANGE: add translations
@@ -428,13 +429,19 @@ def print_qstr_data(qcfgs, qstrs, translations):
428429
qbytes = make_bytes(cfg_bytes_len, cfg_bytes_hash, qstr)
429430
print("QDEF0(MP_QSTR_%s, %s)" % (qstr_escape(qstr), qbytes))
430431

432+
# CIRCUITPY-CHANGE: track total qstr size
433+
total_qstr_size = 0
434+
431435
# add remaining qstrs to the sorted (by value) pool (unless they're in
432436
# operator_qstr_list, in which case add them to the unsorted pool)
433437
for ident, qstr in sorted(qstrs.values(), key=lambda x: x[1]):
434438
qbytes = make_bytes(cfg_bytes_len, cfg_bytes_hash, qstr)
435439
pool = 0 if qstr in operator_qstr_list else 1
436440
print("QDEF%d(MP_QSTR_%s, %s)" % (pool, ident, qbytes))
437441

442+
# CIRCUITPY-CHANGE: track total qstr size
443+
total_qstr_size += len(qstr)
444+
438445
# CIRCUITPY-CHANGE: translations
439446
print(
440447
"// Enumerate translated texts but don't actually include translations. Instead, the linker will link them in."

py/makeqstrdefs.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,8 +152,8 @@ def process_file(f):
152152
)
153153
elif args.mode == _MODE_ROOT_POINTER:
154154
re_match = re.compile(r"MP_REGISTER_ROOT_POINTER\(.*?\);")
155-
# CIRCUITPY-CHANGE: added
156-
re_translate = re.compile(r"MP_COMPRESSED_ROM_TEXT\(\"((?:(?=(\\?))\2.)*?)\"\)")
155+
# CIRCUITPY-CHANGE: added
156+
re_translate = re.compile(r"MP_COMPRESSED_ROM_TEXT\(\"((?:(?=(\\?))\2.)*?)\"\)")
157157
output = []
158158
last_fname = None
159159
for line in f:

py/maketranslationdata.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -527,7 +527,7 @@ def esc_char(m):
527527

528528
def parse_qstrs(infile):
529529
r = {}
530-
rx = re.compile(r'QDEF\([A-Za-z0-9_]+,\s*\d+,\s*\d+,\s*(?P<cstr>"(?:[^"\\\\]*|\\.)")\)')
530+
rx = re.compile(r'QDEF[01]\([A-Za-z0-9_]+,\s*\d+,\s*\d+,\s*(?P<cstr>"(?:[^"\\\\]*|\\.)")\)')
531531
content = infile.read()
532532
for i, mat in enumerate(rx.findall(content, re.M)):
533533
mat = eval(mat)

py/makeversionhdr.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"""
22
Generate header file with macros defining MicroPython version info.
33
4-
# CIRCUITPY-CHANGE: This script is thoroughly reword for use with CircuitPython.
4+
# CIRCUITPY-CHANGE: This script is thoroughly reworked for use with CircuitPython.
55
This script works with Python 3.7 and newer
66
"""
77

@@ -117,6 +117,7 @@ def make_version_header(repo_path, filename):
117117
#define MICROPY_VERSION_MAJOR (%s)
118118
#define MICROPY_VERSION_MINOR (%s)
119119
#define MICROPY_VERSION_MICRO (%s)
120+
#define MICROPY_VERSION_PRERELEASE 0
120121
#define MICROPY_VERSION_STRING "%s"
121122
// Combined version as a 32-bit number for convenience
122123
#define MICROPY_VERSION (MICROPY_VERSION_MAJOR << 16 | MICROPY_VERSION_MINOR << 8 | MICROPY_VERSION_MICRO)

py/modsys.c

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -82,20 +82,12 @@ STATIC const mp_rom_obj_tuple_t mp_sys_implementation_version_info_obj = {
8282
}
8383
};
8484
STATIC const MP_DEFINE_STR_OBJ(mp_sys_implementation_machine_obj, MICROPY_BANNER_MACHINE);
85+
// CIRCUITPY-CHANGE: MP_QSTR_circuitpython
8586
#define SYS_IMPLEMENTATION_ELEMS_BASE \
8687
MP_ROM_QSTR(MP_QSTR_circuitpython), \
8788
MP_ROM_PTR(&mp_sys_implementation_version_info_obj), \
8889
MP_ROM_PTR(&mp_sys_implementation_machine_obj)
8990

90-
#if MICROPY_PERSISTENT_CODE_LOAD
91-
#define SYS_IMPLEMENTATION_ELEMS__MPY \
92-
, MP_ROM_INT(MPY_FILE_HEADER_INT)
93-
#else
94-
#define SYS_IMPLEMENTATION_ELEMS \
95-
MP_ROM_QSTR(MP_QSTR_micropython), \
96-
MP_ROM_PTR(&mp_sys_implementation_version_info_obj), \
97-
MP_ROM_PTR(&mp_sys_implementation_machine_obj)
98-
9991
#if MICROPY_PERSISTENT_CODE_LOAD
10092
#define SYS_IMPLEMENTATION_ELEMS__MPY \
10193
, MP_ROM_INT(MPY_FILE_HEADER_INT)

py/mpconfig.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@
6161
#define MICROPY_VERSION_STRING MICROPY_VERSION_STRING_BASE
6262
#endif
6363

64+
#endif // CIRCUITPY
65+
6466
// If this is enabled, then in-progress/breaking changes slated for the 2.x
6567
// release will be enabled.
6668
#ifndef MICROPY_PREVIEW_VERSION_2

py/objexcept.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -573,7 +573,7 @@ mp_obj_t mp_obj_new_exception_msg_vlist(const mp_obj_type_t *exc_type, mp_rom_er
573573
// We have some memory to format the string.
574574
struct _exc_printer_t exc_pr = {!used_emg_buf, o_str_alloc, 0, o_str_buf};
575575
mp_print_t print = {&exc_pr, exc_add_strn};
576-
mp_vcprintf(&print, fmt, ap);
576+
mp_vcprintf(&print, fmt, args);
577577
exc_pr.buf[exc_pr.len] = '\0';
578578
o_str->len = exc_pr.len;
579579
o_str->data = exc_pr.buf;

0 commit comments

Comments
 (0)