RP2040 now builds

This commit is contained in:
Dan Halbert 2023-10-05 14:49:49 -04:00
parent 7e0e6fcdca
commit 06765ccfa6
10 changed files with 27 additions and 11 deletions

View File

@ -126,10 +126,10 @@ espnow_peers_obj_t *espnow_peers_new(void) {
MP_DEFINE_CONST_OBJ_TYPE( MP_DEFINE_CONST_OBJ_TYPE(
espnow_peers_type, espnow_peers_type,
MP_QSTR_Peers, MP_QSTR_Peers,
MP_TYPE_FLAG_NONE, MP_TYPE_FLAG_ITER_IS_GETITER,
print, espnow_peers_print, print, espnow_peers_print,
locals_dict, &espnow_peers_locals_dict, locals_dict, &espnow_peers_locals_dict,
unary_op, espnow_peers_unary_op, unary_op, espnow_peers_unary_op,
subscr, espnow_peers_subscr, subscr, espnow_peers_subscr,
getiter, espnow_peers_getiter iter, espnow_peers_getiter
); );

View File

@ -487,5 +487,5 @@ void isr_dma_0(void) {
} }
} }
MP_REGISTER_ROOT_POINTER(mp_obj_t playing_audio[NUM_DMA_CHANNELS]); MP_REGISTER_ROOT_POINTER(mp_obj_t playing_audio[enum_NUM_DMA_CHANNELS]);
#endif #endif

View File

@ -255,5 +255,5 @@ MP_DEFINE_CONST_OBJ_TYPE(
locals_dict, &picodvi_framebuffer_locals_dict, locals_dict, &picodvi_framebuffer_locals_dict,
make_new, picodvi_framebuffer_make_new, make_new, picodvi_framebuffer_make_new,
buffer, common_hal_picodvi_framebuffer_get_buffer, buffer, common_hal_picodvi_framebuffer_get_buffer,
protocol, &picodvi_framebuffer_proto, protocol, &picodvi_framebuffer_proto
); );

View File

@ -112,4 +112,4 @@ void counter_interrupt_handler(void) {
} }
} }
MP_REGISTER_ROOT_POINTER(mp_obj_t counting[NUM_PWM_SLICES]); MP_REGISTER_ROOT_POINTER(mp_obj_t counting[enum_NUM_PWM_SLICES]);

View File

@ -1099,4 +1099,6 @@ int common_hal_rp2pio_statemachine_get_pending(rp2pio_statemachine_obj_t *self)
return self->pending_buffers; return self->pending_buffers;
} }
MP_REGISTER_ROOT_POINTER(mp_obj_t background_pio[NUM_DMA_CHANNELS]); // Use a compile-time constant for MP_REGISTER_POINTER so the preprocessor will
// not split the expansion across multiple lines.
MP_REGISTER_ROOT_POINTER(mp_obj_t background_pio[enum_NUM_DMA_CHANNELS]);

View File

@ -68,5 +68,12 @@ extern critical_section_t background_queue_lock;
#define CALLBACK_CRITICAL_BEGIN (critical_section_enter_blocking(&background_queue_lock)) #define CALLBACK_CRITICAL_BEGIN (critical_section_enter_blocking(&background_queue_lock))
#define CALLBACK_CRITICAL_END (critical_section_exit(&background_queue_lock)) #define CALLBACK_CRITICAL_END (critical_section_exit(&background_queue_lock))
// Turn some macros into compile-time constants, using enum.
// Some nested macros expand across multiple lines, which is not
// handled by the MP_REGISTER_ROOT_POINTER processing in makeqstrdefs.py.
enum {
enum_NUM_DMA_CHANNELS = NUM_DMA_CHANNELS,
enum_NUM_PWM_SLICES = NUM_PWM_SLICES,
};
#endif // __INCLUDED_MPCONFIGPORT_H #endif // __INCLUDED_MPCONFIGPORT_H

View File

@ -130,8 +130,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
usb_core_devices_type, usb_core_devices_type,
MP_QSTR_USBDevices, MP_QSTR_USBDevices,
MP_TYPE_FLAG_ITER_IS_ITERNEXT, MP_TYPE_FLAG_ITER_IS_ITERNEXT,
getiter, mp_identity_getiter, iter, usb_core_devices_iternext
iternext, usb_core_devices_iternext
); );
STATIC mp_obj_t usb_core_find(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { STATIC mp_obj_t usb_core_find(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {

View File

@ -34,7 +34,7 @@ extern const mp_obj_module_t usb_core_module;
void usb_core_exception_print(const mp_print_t *print, mp_obj_t o_in, mp_print_kind_t kind); void usb_core_exception_print(const mp_print_t *print, mp_obj_t o_in, mp_print_kind_t kind);
#define MP_DEFINE_USB_CORE_EXCEPTION(exc_name, base_name) \ /*#define MP_DEFINE_USB_CORE_EXCEPTION(exc_name, base_name) \
const mp_obj_type_t mp_type_usb_core_##exc_name = { \ const mp_obj_type_t mp_type_usb_core_##exc_name = { \
{ &mp_type_type }, \ { &mp_type_type }, \
.name = MP_QSTR_##exc_name, \ .name = MP_QSTR_##exc_name, \
@ -42,7 +42,14 @@ void usb_core_exception_print(const mp_print_t *print, mp_obj_t o_in, mp_print_k
.make_new = mp_obj_exception_make_new, \ .make_new = mp_obj_exception_make_new, \
.attr = mp_obj_exception_attr, \ .attr = mp_obj_exception_attr, \
.parent = &mp_type_##base_name, \ .parent = &mp_type_##base_name, \
}; };*/
#define MP_DEFINE_USB_CORE_EXCEPTION(exc_name, base_name) \
MP_DEFINE_CONST_OBJ_TYPE(mp_type_usb_core_##exc_name, MP_QSTR_##exc_name, MP_TYPE_FLAG_NONE, \
make_new, mp_obj_exception_make_new, \
print, usb_core_exception_print, \
attr, mp_obj_exception_attr, \
parent, &mp_type_##base_name \
);
extern const mp_obj_type_t mp_type_usb_core_USBError; extern const mp_obj_type_t mp_type_usb_core_USBError;
extern const mp_obj_type_t mp_type_usb_core_USBTimeoutError; extern const mp_obj_type_t mp_type_usb_core_USBTimeoutError;

View File

@ -72,6 +72,7 @@ STATIC MP_DEFINE_CONST_DICT(usb_host_port_locals_dict, usb_host_port_locals_dict
MP_DEFINE_CONST_OBJ_TYPE( MP_DEFINE_CONST_OBJ_TYPE(
usb_host_port_type, usb_host_port_type,
MP_QSTR_Port, MP_QSTR_Port,
MP_TYPE_FLAG_NONE,
make_new, usb_host_port_make_new, make_new, usb_host_port_make_new,
locals_dict, &usb_host_port_locals_dict locals_dict, &usb_host_port_locals_dict
); );

View File

@ -70,5 +70,5 @@ mp_obj_t utf16le_to_string(const uint16_t *buf, size_t utf16_len) {
vstr_init(&vstr, utf16_len); vstr_init(&vstr, utf16_len);
utf16_str utf = {buf, utf16_len}; utf16_str utf = {buf, utf16_len};
_convert_utf16le_to_utf8(&vstr, &utf); _convert_utf16le_to_utf8(&vstr, &utf);
return mp_obj_new_str_from_vstr(&mp_type_str, &vstr); return mp_obj_new_str_from_vstr(&vstr);
} }