Skip to content

Commit 58277a4

Browse files
committed
Reordered mpconfigport.mk; replaced MXC_SYS includes with max32_port.h in microcontroller/Pin.c
1 parent 00d95cb commit 58277a4

7 files changed

Lines changed: 21 additions & 32 deletions

File tree

ports/analog/Makefile

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,8 @@ CFLAGS += -D$(MCU_VARIANT_UPPER) \
147147
-DTARGET=$(MCU_VARIANT_UPPER) \
148148
-DIAR_PRAGMAS=0 \
149149
-DRISCV_LOAD=0
150+
151+
# todo: add these for linkerfiles later on so that it's easier to add new boards
150152
# -DFLASH_ORIGIN=0x10000000 \
151153
# -DFLASH_SIZE=0x340000 \
152154
# -DSRAM_ORIGIN=0x20000000 \
@@ -193,7 +195,9 @@ SRC_C += \
193195

194196
CFLAGS += $(INC) -Werror -Wall -std=gnu11 -nostartfiles $(BASE_CFLAGS) $(COPT)
195197

196-
# Suppress some warnings for MSDK
198+
# Suppress some errors for MSDK
199+
# cast-align warning will be suppressed;
200+
# it gets generated by CircuitPy's TLSF memory allocator lib
197201
CFLAGS += -Wno-error=unused-parameter \
198202
-Wno-error=old-style-declaration \
199203
-Wno-error=sign-compare \
@@ -203,7 +207,8 @@ CFLAGS += -Wno-error=unused-parameter \
203207
-Wno-error=lto-type-mismatch \
204208
-Wno-error=cast-align \
205209
-Wno-error=nested-externs \
206-
-Wno-error=sign-compare
210+
-Wno-error=sign-compare \
211+
-Wno-cast-align \
207212

208213
ENTRY = Reset_Handler
209214
LDFLAGS += $(CFLAGS) --entry $(ENTRY) -Wl,-nostdlib -Wl,-T,$(LINKERFILE) -Wl,-Map=$@.map -Wl,-cref -Wl,-gc-sections

ports/analog/common-hal/digitalio/DigitalInOut.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
//
55
// SPDX-License-Identifier: MIT
66

7+
#define CIRCUITPY_DIGITALIO_HAVE_INVALID_DRIVE_MODE 1
78
#include "shared-bindings/digitalio/DigitalInOut.h"
89
#include "shared-bindings/microcontroller/Pin.h"
910

@@ -70,9 +71,9 @@ digitalinout_result_t common_hal_digitalio_digitalinout_switch_to_output(
7071

7172
// todo (low): MSDK Hardware does not support open-drain configuration except
7273
// todo (low): when directly managed by a peripheral such as I2C.
73-
// todo (low): find a way to signal this perhaps to any upstream code
74+
// todo (low): find a way to signal this to any upstream code
7475
if (drive_mode != DRIVE_MODE_PUSH_PULL) {
75-
return DIGITALINOUT_OK;
76+
return DIGITALINOUT_INVALID_DRIVE_MODE;
7677
}
7778
return DIGITALINOUT_OK;
7879
}

ports/analog/common-hal/microcontroller/Pin.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,7 @@
1010
#include "mpconfigboard.h"
1111
#include "pins.h"
1212

13-
#include "mxc_sys.h"
14-
#include "gpio.h"
15-
#include "gpio_regs.h"
13+
#include "max32_port.h"
1614

1715
#include "common-hal/microcontroller/Pin.h"
1816

@@ -79,7 +77,7 @@ uint8_t common_hal_mcu_pin_number(const mcu_pin_obj_t *pin) {
7977
}
8078

8179
// most max32 gpio ports have 32 pins
82-
// todo: create a struct to encode # of pins for each port, since some GPIO ports differ
80+
// todo (low prior.): encode # of pins for each port, since some GPIO ports differ
8381
return pin->port * 32 + pin->mask;
8482
}
8583

ports/analog/mpconfigport.mk

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,6 @@ INTERNAL_FLASH_FILESYSTEM = 1
2121
####################################################################################
2222
# These modules are implemented in ports/<port>/common-hal:
2323

24-
# Typically the second module to create
25-
CIRCUITPY_DIGITALIO ?= 1
26-
2724
# Plan to implement
2825
CIRCUITPY_BUSIO ?= 0
2926
CIRCUITPY_RTC ?= 0
@@ -47,21 +44,20 @@ CIRCUITPY_DISPLAYIO ?= 0
4744

4845
# These modules are implemented in shared-module/ - they can be included in
4946
# any port once their prerequisites in common-hal are complete.
47+
# No requirements, but takes extra flash
48+
CIRCUITPY_ULAB = 1
5049
# Requires DigitalIO:
51-
CIRCUITPY_BITBANGIO ?= 0
52-
# Requires neopixel_write or SPI (dotstar)
53-
CIRCUITPY_PIXELBUF ?= 0
50+
CIRCUITPY_BITBANGIO ?= 1
51+
# Requires Microcontroller
52+
CIRCUITPY_TOUCHIO ?= 1
5453
# Requires OS
5554
CIRCUITPY_RANDOM ?= 0
56-
# Requires Microcontroller
57-
CIRCUITPY_TOUCHIO ?= 0
58-
# Requires UART
55+
# Requires busio.UART
5956
CIRCUITPY_CONSOLE_UART ?= 0
6057
# Does nothing without I2C
6158
CIRCUITPY_REQUIRE_I2C_PULLUPS = 0
62-
63-
# No requirements, but takes extra flash
64-
CIRCUITPY_ULAB = 1
59+
# Requires neopixel_write or SPI (dotstar)
60+
CIRCUITPY_PIXELBUF ?= 0
6561

6662
####################################################################################
6763
# Required for clean building (additional CircuittPython Defaults)

ports/analog/peripherals/led.h

Lines changed: 0 additions & 5 deletions
This file was deleted.

ports/analog/supervisor/internal_flash.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ mp_uint_t supervisor_flash_write_blocks(const uint8_t *src, uint32_t block_num,
187187
uint32_t error, blocks_left, count, page_start, page_size = 0;
188188

189189
while (num_blocks > 0) {
190-
uint32_t dest_addr = block2addr(block_num);
190+
int dest_addr = block2addr(block_num);
191191
// bad block number passed in
192192
if (dest_addr == -1) {
193193
return 1;

ports/analog/supervisor/port.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,6 @@
3737
#include "common-hal/microcontroller/Pin.h"
3838
#include "shared-bindings/microcontroller/__init__.h"
3939

40-
//todo: pack the below definitions into their own module
41-
//todo: under peripherals/gpio, peripherals/clocks, etc.
42-
4340
// Sys includes
4441
#include "max32_port.h"
4542

@@ -62,9 +59,6 @@ extern const int num_pbs;
6259
extern const mxc_gpio_cfg_t led_pin[];
6360
extern const int num_leds;
6461

65-
//todo: define an LED HAL
66-
// #include "peripherals/led.h"
67-
6862
// For saving rtc data for ticks
6963
static uint32_t subsec, sec = 0;
7064
static uint32_t tick_flag = 0;

0 commit comments

Comments
 (0)