Skip to content

Commit 547d1d8

Browse files
committed
please build i need this
1 parent 9653e35 commit 547d1d8

2 files changed

Lines changed: 6 additions & 17 deletions

File tree

bricks/_common/common.mk

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -300,9 +300,7 @@ PY_EXTRA_SRC_C += $(addprefix bricks/_common/,\
300300

301301
# --- UNIFIED ODOMETRY ENGINE (3-LAYER ARCHITECTURE) ---
302302
# Compiling both the module wrapper and the logic core
303-
PY_EXTRA_SRC_C += \
304-
pybricks/experimental/pb_module_experimental.c \
305-
pybricks/experimental/odometry_core.c
303+
PY_EXTRA_SRC_C += pybricks/experimental/odometry_core.c
306304

307305
# Not all MCUs support thumb2 instructions.
308306
ifeq ($(PB_MCU_FAMILY),native)

pybricks/experimental/pb_module_experimental.c

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
#define STATIC static
1111
#endif
1212

13-
// 1. The function logic
13+
// 1. The actual function logic
1414
STATIC mp_obj_t experimental_odometry_benchmark(size_t n_args, const mp_obj_t *args) {
1515
int num_iters = mp_obj_get_int(args[0]);
1616
float wheel_circ = mp_obj_get_float(args[1]);
@@ -22,21 +22,12 @@ STATIC mp_obj_t experimental_odometry_benchmark(size_t n_args, const mp_obj_t *a
2222
}
2323
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(experimental_odometry_benchmark_obj, 5, 5, experimental_odometry_benchmark);
2424

25-
// 2. The Globals Table
25+
// 2. The Globals Table - the system looks for the name "<filename>_globals"
26+
// Since your file is pb_module_experimental.c, it looks for pb_module_experimental_globals
2627
STATIC const mp_rom_map_elem_t pb_module_experimental_globals_table[] = {
2728
{ MP_ROM_QSTR(MP_QSTR_odometry_benchmark), MP_ROM_PTR(&experimental_odometry_benchmark_obj) },
2829
};
29-
30-
// 3. THE FIX: Define the dict WITHOUT 'STATIC'.
31-
// This makes it a globally visible symbol that the linker can grab,
32-
// and stops the compiler from complaining that it's "unused" inside this file.
33-
MP_DEFINE_CONST_DICT(pb_module_experimental_globals, pb_module_experimental_globals_table);
34-
35-
// We define the module struct here so the linker finds it.
36-
// We DO NOT use STATIC, and we DO NOT use MP_REGISTER_MODULE.
37-
const mp_obj_module_t pb_module_experimental = {
38-
.base = { &mp_type_module },
39-
.globals = (mp_obj_dict_t *)&pb_module_experimental_globals,
40-
};
30+
// This is the specific symbol the linker is clashing on - we keep it STATIC here.
31+
STATIC MP_DEFINE_CONST_DICT(pb_module_experimental_globals, pb_module_experimental_globals_table);
4132

4233
#endif // PYBRICKS_PY_EXPERIMENTAL

0 commit comments

Comments
 (0)