Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions bricks/_common/arm_none_eabi.mk
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,6 @@ endif
# qstr definitions (must come before including py.mk)
QSTR_DEFS = $(PBTOP)/bricks/_common/qstrdefs.h
QSTR_GLOBAL_DEPENDENCIES = $(PBTOP)/bricks/_common/mpconfigport.h
ifeq ($(PB_MCU_FAMILY),STM32)
QSTR_GLOBAL_DEPENDENCIES += ../_common_stm32/mpconfigport.h
endif

# MicroPython feature configurations
MICROPY_ROM_TEXT_COMPRESSION ?= 1
Expand Down
45 changes: 45 additions & 0 deletions bricks/_common/mpconfigport.h
Original file line number Diff line number Diff line change
Expand Up @@ -120,3 +120,48 @@
#if PYBRICKS_OPT_CUSTOM_IMPORT
#define mp_builtin___import__ pb_builtin_import
#endif

#define MICROPY_MPHALPORT_H "../_common/mphalport.h"

// type definitions for the specific machine

#define MICROPY_MAKE_POINTER_CALLABLE(p) ((void *)((mp_uint_t)(p) | 1))

// This port is intended to be 32-bit, but unfortunately, int32_t for
// different targets may be defined in different ways - either as int
// or as long. This requires different printf formatting specifiers
// to print such value. So, we avoid int32_t and use int directly.
#define UINT_FMT "%u"
#define INT_FMT "%d"
typedef int mp_int_t; // must be pointer size
typedef unsigned mp_uint_t; // must be pointer size

typedef long mp_off_t;

#include "pbio_os_config.h"

#define MICROPY_BEGIN_ATOMIC_SECTION() pbio_os_hook_disable_irq()
#define MICROPY_END_ATOMIC_SECTION(state) pbio_os_hook_enable_irq(state)

#define MICROPY_VM_HOOK_LOOP \
do { \
extern bool pbio_os_run_processes_once(void); \
pbio_os_run_processes_once(); \
} while (0);

#define MICROPY_GC_HOOK_LOOP(i) do { \
if (((i) & 0xf) == 0) { \
MICROPY_VM_HOOK_LOOP \
} \
} while (0)

#define MICROPY_EVENT_POLL_HOOK \
do { \
extern void pb_event_poll_hook(void); \
pb_event_poll_hook(); \
} while (0);

// We need to provide a declaration/definition of alloca()
#include <alloca.h>

#define MP_STATE_PORT MP_STATE_VM
53 changes: 0 additions & 53 deletions bricks/_common_stm32/mpconfigport.h

This file was deleted.

2 changes: 1 addition & 1 deletion bricks/cityhub/mpconfigport.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,4 @@
#define PYBRICKS_OPT_CUSTOM_IMPORT (1)
#define PYBRICKS_OPT_NATIVE_MOD (0)

#include "../_common_stm32/mpconfigport.h"
#include "../_common/mpconfigport.h"
2 changes: 1 addition & 1 deletion bricks/essentialhub/mpconfigport.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,4 @@
#define PYBRICKS_OPT_CUSTOM_IMPORT (1)
#define PYBRICKS_OPT_NATIVE_MOD (0)

#include "../_common_stm32/mpconfigport.h"
#include "../_common/mpconfigport.h"
51 changes: 1 addition & 50 deletions bricks/ev3/mpconfigport.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,54 +57,5 @@
#define PYBRICKS_OPT_EXTRA_LEVEL2 (1)
#define PYBRICKS_OPT_CUSTOM_IMPORT (1)
#define PYBRICKS_OPT_NATIVE_MOD (1)
// Start with config shared by all Pybricks ports.
#include "../_common/mpconfigport.h"

// Reduced from 256 for better raw paste stability.
// FIXME: USB driver limitation -- should allow higher.
#define MICROPY_REPL_STDIN_BUFFER_MAX (64)

#define MICROPY_MPHALPORT_H "../_common/mphalport.h"

// type definitions for the specific machine

#define MICROPY_MAKE_POINTER_CALLABLE(p) ((void *)((mp_uint_t)(p) | 1))

// This port is intended to be 32-bit, but unfortunately, int32_t for
// different targets may be defined in different ways - either as int
// or as long. This requires different printf formatting specifiers
// to print such value. So, we avoid int32_t and use int directly.
#define UINT_FMT "%u"
#define INT_FMT "%d"
typedef int mp_int_t; // must be pointer size
typedef unsigned mp_uint_t; // must be pointer size

typedef long mp_off_t;

#include "pbio_os_config.h"

#define MICROPY_BEGIN_ATOMIC_SECTION() pbio_os_hook_disable_irq()
#define MICROPY_END_ATOMIC_SECTION(state) pbio_os_hook_enable_irq(state)

#define MICROPY_VM_HOOK_LOOP \
do { \
extern bool pbio_os_run_processes_once(void); \
pbio_os_run_processes_once(); \
} while (0);

#define MICROPY_GC_HOOK_LOOP(i) do { \
if (((i) & 0xf) == 0) { \
MICROPY_VM_HOOK_LOOP \
} \
} while (0)

#define MICROPY_EVENT_POLL_HOOK \
do { \
extern void pb_event_poll_hook(void); \
pb_event_poll_hook(); \
} while (0);

// We need to provide a declaration/definition of alloca()
#include <alloca.h>

#define MP_STATE_PORT MP_STATE_VM
#include "../_common/mpconfigport.h"
2 changes: 1 addition & 1 deletion bricks/movehub/mpconfigport.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,4 @@
#define PYBRICKS_OPT_CUSTOM_IMPORT (1)
#define PYBRICKS_OPT_NATIVE_MOD (0)

#include "../_common_stm32/mpconfigport.h"
#include "../_common/mpconfigport.h"
46 changes: 0 additions & 46 deletions bricks/nxt/mpconfigport.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,50 +57,4 @@
#define PYBRICKS_OPT_CUSTOM_IMPORT (1)
#define PYBRICKS_OPT_NATIVE_MOD (0)

// Start with config shared by all Pybricks ports.
#include "../_common/mpconfigport.h"

#define MICROPY_MPHALPORT_H "../_common/mphalport.h"

// type definitions for the specific machine

#define MICROPY_MAKE_POINTER_CALLABLE(p) ((void *)((mp_uint_t)(p) | 1))

// This port is intended to be 32-bit, but unfortunately, int32_t for
// different targets may be defined in different ways - either as int
// or as long. This requires different printf formatting specifiers
// to print such value. So, we avoid int32_t and use int directly.
#define UINT_FMT "%u"
#define INT_FMT "%d"
typedef int mp_int_t; // must be pointer size
typedef unsigned mp_uint_t; // must be pointer size

typedef long mp_off_t;

// We need to provide a declaration/definition of alloca()
#include <alloca.h>

#include "pbio_os_config.h"

#define MICROPY_BEGIN_ATOMIC_SECTION() pbio_os_hook_disable_irq()
#define MICROPY_END_ATOMIC_SECTION(state) pbio_os_hook_enable_irq(state)

#define MICROPY_VM_HOOK_LOOP \
do { \
extern bool pbio_os_run_processes_once(void); \
pbio_os_run_processes_once(); \
} while (0);

#define MICROPY_GC_HOOK_LOOP(i) do { \
if (((i) & 0xf) == 0) { \
MICROPY_VM_HOOK_LOOP \
} \
} while (0)

#define MICROPY_EVENT_POLL_HOOK \
do { \
extern void pb_event_poll_hook(void); \
pb_event_poll_hook(); \
} while (0);

#define MP_STATE_PORT MP_STATE_VM
2 changes: 1 addition & 1 deletion bricks/primehub/mpconfigport.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,4 @@
#define PYBRICKS_OPT_CUSTOM_IMPORT (1)
#define PYBRICKS_OPT_NATIVE_MOD (1)

#include "../_common_stm32/mpconfigport.h"
#include "../_common/mpconfigport.h"
2 changes: 1 addition & 1 deletion bricks/technichub/mpconfigport.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,4 @@
#define PYBRICKS_OPT_CUSTOM_IMPORT (1)
#define PYBRICKS_OPT_NATIVE_MOD (0)

#include "../_common_stm32/mpconfigport.h"
#include "../_common/mpconfigport.h"