Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit a80d3b1

Browse files
thinkyheadmlee12382
andauthoredSep 24, 2024··
Update platform for MKS Tinybee and others (#27433)
* 🔨 Update ESP32 env for MKS Tinybee * 🔨 Updated LPC common env * 🔨 Other env improvements Co-Authored-By: Michael <89716126+mlee12382@users.noreply.github.com>
1 parent a923771 commit a80d3b1

File tree

11 files changed

+86
-34
lines changed

11 files changed

+86
-34
lines changed
 

‎Marlin/src/HAL/ESP32/HAL.cpp

+9-8
Original file line numberDiff line numberDiff line change
@@ -209,16 +209,17 @@ int MarlinHAL::freeMemory() { return ESP.getFreeHeap(); }
209209
// ADC
210210
// ------------------------
211211

212-
#define ADC1_CHANNEL(pin) ADC1_GPIO ## pin ## _CHANNEL
213-
212+
// https://docs.espressif.com/projects/esp-idf/en/release-v4.4/esp32/api-reference/peripherals/adc.html
214213
adc1_channel_t get_channel(int pin) {
215214
switch (pin) {
216-
case 39: return ADC1_CHANNEL(39);
217-
case 36: return ADC1_CHANNEL(36);
218-
case 35: return ADC1_CHANNEL(35);
219-
case 34: return ADC1_CHANNEL(34);
220-
case 33: return ADC1_CHANNEL(33);
221-
case 32: return ADC1_CHANNEL(32);
215+
case 39: return ADC1_CHANNEL_3;
216+
case 36: return ADC1_CHANNEL_0;
217+
case 35: return ADC1_CHANNEL_7;
218+
case 34: return ADC1_CHANNEL_6;
219+
case 33: return ADC1_CHANNEL_5;
220+
case 32: return ADC1_CHANNEL_4;
221+
case 37: return ADC1_CHANNEL_1;
222+
case 38: return ADC1_CHANNEL_2;
222223
}
223224
return ADC1_CHANNEL_MAX;
224225
}

‎Marlin/src/HAL/ESP32/timers.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ void HAL_timer_start(const uint8_t timer_num, const uint32_t frequency) {
9090
config.counter_en = TIMER_PAUSE;
9191
config.alarm_en = TIMER_ALARM_EN;
9292
config.intr_type = TIMER_INTR_LEVEL;
93-
config.auto_reload = true;
93+
config.auto_reload = TIMER_AUTORELOAD_EN;
9494

9595
// Select and initialize the timer
9696
timer_init(timer.group, timer.idx, &config);

‎Marlin/src/inc/MarlinConfigPre-1-axes.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
#define __MARLIN_FIRMWARE__
2626
#endif
2727

28-
#if __has_include("../../Config.h")
28+
#if __has_include("../../../Marlin/Config.h")
2929
#include "../../Config.h"
3030
#else
3131
#define USE_STD_CONFIGS 1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
{
2+
"build": {
3+
"arduino":{
4+
"ldscript": "esp32_out.ld"
5+
},
6+
"core": "esp32",
7+
"extra_flags": "-DARDUINO_ESP32_DEV",
8+
"f_cpu": "240000000L",
9+
"f_flash": "40000000L",
10+
"flash_mode": "dio",
11+
"mcu": "esp32",
12+
"variant": "esp32"
13+
},
14+
"connectivity": [
15+
"wifi",
16+
"bluetooth",
17+
"ethernet",
18+
"can"
19+
],
20+
"debug": {
21+
"openocd_board": "esp-wroom-32.cfg"
22+
},
23+
"frameworks": [
24+
"arduino",
25+
"espidf"
26+
],
27+
"name": "MKS TinyBee V1.0",
28+
"upload": {
29+
"flash_size": "8MB",
30+
"maximum_ram_size": 524288,
31+
"maximum_size": 8388608,
32+
"require_upload_port": true,
33+
"speed": 460800,
34+
"offset_address": 65536
35+
},
36+
"url": "https://github.com/makerbase-mks/MKS-TinyBee",
37+
"vendor": "MKS Makerbase"
38+
}

‎ini/esp32.ini

+5
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,14 @@ board_build.partitions = Marlin/src/HAL/ESP32/esp32.csv
3939
upload_speed = 115200
4040
monitor_speed = 115200
4141

42+
# New espressif32 packages require a valid board definition file.
4243
[env:mks_tinybee]
4344
extends = env:esp32
45+
board = marlin_MKS_TinyBee
46+
platform = espressif32@~3.5.0
4447
board_build.partitions = default_8MB.csv
48+
build_src_flags = -O3 -Wno-volatile
49+
monitor_filters = esp32_exception_decoder
4550

4651
[env:godi_esp32]
4752
extends = env:esp32

‎ini/features.ini

-5
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,6 @@ HAS_MARLINUI_HD44780 = build_src_filter=+<src/lcd/HD44780>
4040
HAS_MARLINUI_U8GLIB = marlinfirmware/U8glib-HAL@0.5.4
4141
build_src_filter=+<src/lcd/dogm>
4242
HAS_(FSMC|SPI|LTDC)_TFT = build_src_filter=+<src/lcd/tft_io>
43-
HAS_LTDC_TFT = build_src_filter=+<src/HAL/STM32/tft/tft_ltdc.cpp>
44-
HAS_FSMC_TFT = build_src_filter=+<src/HAL/STM32/tft/tft_fsmc.cpp> +<src/HAL/STM32F1/tft/tft_fsmc.cpp>
45-
HAS_SPI_TFT = build_src_filter=+<src/HAL/STM32/tft/tft_spi.cpp> +<src/HAL/STM32F1/tft/tft_spi.cpp> +<src/HAL/LPC1768/tft/tft_spi.cpp>
46-
HAS_TFT_XPT2046 = build_src_filter=+<src/HAL/STM32/tft/xpt2046.cpp> +<src/HAL/STM32F1/tft/xpt2046.cpp> +<src/HAL/LPC1768/tft/xpt2046.cpp>
47-
TFT_TOUCH_DEVICE_GT911 = build_src_filter=+<src/HAL/STM32/tft/gt911.cpp>
4843
I2C_EEPROM = build_src_filter=+<src/HAL/shared/eeprom_if_i2c.cpp>
4944
SOFT_I2C_EEPROM = SlowSoftI2CMaster, SlowSoftWire=https://github.com/felias-fogg/SlowSoftWire/archive/f34d777f39.zip
5045
SPI_EEPROM = build_src_filter=+<src/HAL/shared/eeprom_if_spi.cpp>

‎ini/lpc176x.ini

+11-8
Original file line numberDiff line numberDiff line change
@@ -14,23 +14,26 @@
1414
#
1515
[common_LPC]
1616
platform = https://github.com/p3p/pio-nxplpc-arduino-lpc176x/archive/0.1.3.zip
17-
platform_packages = framework-arduino-lpc176x@^0.2.8
17+
platform_packages = framework-arduino-lpc176x@^0.2.9
1818
toolchain-gccarmnoneeabi@1.100301.220327
1919
board = nxp_lpc1768
2020
lib_ldf_mode = off
2121
lib_compat_mode = strict
2222
extra_scripts = ${common.extra_scripts}
23-
Marlin/src/HAL/LPC1768/upload_extra_script.py
23+
Marlin/src/HAL/LPC1768/upload_extra_script.py
2424
build_src_filter = ${common.default_src_filter} +<src/HAL/LPC1768> -<src/HAL/LPC1768/tft> +<src/HAL/shared/backtrace>
2525
lib_deps = ${common.lib_deps}
26-
Servo
27-
custom_marlin.USES_LIQUIDCRYSTAL = arduino-libraries/LiquidCrystal@~1.0.7
28-
custom_marlin.NEOPIXEL_LED = Adafruit NeoPixel=https://github.com/p3p/Adafruit_NeoPixel/archive/1.5.0.zip
26+
Servo
2927
build_flags = ${common.build_flags} -DU8G_HAL_LINKS -DPLATFORM_M997_SUPPORT
3028
-IMarlin/src/HAL/LPC1768/include -IMarlin/src/HAL/LPC1768/u8g
31-
# debug options for backtrace
32-
#-funwind-tables
33-
#-mpoke-function-name
29+
# debug options for backtrace
30+
#-funwind-tables
31+
#-mpoke-function-name
32+
build_src_flags = -std=gnu++20 -Wno-volatile
33+
custom_marlin.USES_LIQUIDCRYSTAL = arduino-libraries/LiquidCrystal@~1.0.7
34+
custom_marlin.NEOPIXEL_LED = Adafruit NeoPixel=https://github.com/p3p/Adafruit_NeoPixel/archive/1.5.0.zip
35+
custom_marlin.HAS_SPI_TFT = build_src_filter=+<src/HAL/LPC1768/tft/tft_spi.cpp>
36+
custom_marlin.HAS_TFT_XPT2046 = build_src_filter=+<src/HAL/LPC1768/tft/xpt2046.cpp>
3437

3538
#
3639
# NXP LPC176x ARM Cortex-M3

‎ini/stm32-common.ini

+6
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,12 @@ build_unflags = -std=gnu++11
1919
build_src_filter = ${common.default_src_filter} +<src/HAL/STM32> -<src/HAL/STM32/tft> +<src/HAL/shared/backtrace>
2020
extra_scripts = ${common.extra_scripts}
2121
pre:buildroot/share/PlatformIO/scripts/stm32_serialbuffer.py
22+
custom_marlin.HAS_LTDC_TFT = build_src_filter=+<src/HAL/STM32/tft/tft_ltdc.cpp>
23+
custom_marlin.HAS_FSMC_TFT = build_src_filter=+<src/HAL/STM32/tft/tft_fsmc.cpp>
24+
build_flags=-DHAL_SRAM_MODULE_ENABLED
25+
custom_marlin.HAS_SPI_TFT = build_src_filter=+<src/HAL/STM32/tft/tft_spi.cpp>
26+
custom_marlin.HAS_TFT_XPT2046 = build_src_filter=+<src/HAL/STM32/tft/xpt2046.cpp>
27+
custom_marlin.TFT_TOUCH_DEVICE_GT911 = build_src_filter=+<src/HAL/STM32/tft/gt911.cpp>
2228

2329
#
2430
# STM32 board based on a variant.

‎ini/stm32f1-maple.ini

+5-2
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
# HAL/STM32F1 Common Environment values
2424
#
2525
[STM32F1_maple]
26-
platform = ststm32@~12.1
26+
platform = ststm32@~15.4.1
2727
board_build.core = maple
2828
build_flags = !python buildroot/share/PlatformIO/scripts/STM32F1_build_flags.py
2929
${common.build_flags} -DARDUINO_ARCH_STM32 -DMAPLE_STM32F1 -DPLATFORM_M997_SUPPORT
@@ -32,12 +32,15 @@ build_src_filter = ${common.default_src_filter} +<src/HAL/STM32F1> -<src/HAL/ST
3232
lib_ignore = SPI, FreeRTOS701, FreeRTOS821
3333
lib_deps = ${common.lib_deps}
3434
SoftwareSerialM
35-
platform_packages = tool-stm32duino
35+
platform_packages = tool-stm32duino, toolchain-gccarmnoneeabi@1.100301.220327
3636
extra_scripts = ${common.extra_scripts}
3737
pre:buildroot/share/PlatformIO/scripts/fix_framework_weakness.py
3838
pre:buildroot/share/PlatformIO/scripts/stm32_serialbuffer.py
3939
buildroot/share/PlatformIO/scripts/custom_board.py
4040
buildroot/share/PlatformIO/scripts/offset_and_rename.py
41+
custom_marlin.HAS_SPI_TFT = build_src_filter=+<src/HAL/STM32F1/tft/tft_spi.cpp>
42+
custom_marlin.HAS_TFT_XPT2046 = build_src_filter=+<src/HAL/STM32F1/tft/xpt2046.cpp>
43+
custom_marlin.HAS_FSMC_TFT = build_src_filter=+<src/HAL/STM32F1/tft/tft_fsmc.cpp>
4144

4245
#
4346
# Generic STM32F103RC environment

‎ini/stm32f1.ini

+3-3
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ build_flags = ${env:STM32F103RC_btt.build_flags}
7171
-DUSBD_IRQ_PRIO=5
7272
-DUSBD_IRQ_SUBPRIO=6
7373
-DUSBD_USE_CDC_MSC
74-
build_unflags = ${common_stm32.build_unflags} -DUSBD_USE_CDC
74+
build_unflags = ${env:STM32F103RC_btt.build_unflags} -DUSBD_USE_CDC
7575

7676
#
7777
# Panda Pi V2.9 - Standalone (STM32F103RC)
@@ -83,8 +83,8 @@ build_flags = ${common_STM32F103RC_variant.build_flags}
8383
-DTIMER_SERVO=TIM1
8484
board_build.offset = 0x5000
8585
board_upload.offset_address = 0x08005000
86-
lib_deps =
87-
markyue/Panda_SoftMasterI2C@1.0.3
86+
lib_deps = markyue/Panda_SoftMasterI2C@1.0.3
87+
8888
#
8989
# MKS Robin (STM32F103ZET6)
9090
# Uses HAL STM32 to support Marlin UI for TFT screen with optional touch panel

‎ini/stm32f4.ini

+7-6
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ extends = Anet_ET4
153153
board_build.encode = firmware.srec
154154
board_build.offset = 0x10000
155155
board_upload.offset_address = 0x08010000
156-
extra_scripts = ${stm32_variant.extra_scripts}
156+
extra_scripts = ${Anet_ET4.extra_scripts}
157157
buildroot/share/PlatformIO/scripts/openblt.py
158158

159159
#
@@ -497,7 +497,8 @@ build_flags = ${stm_flash_drive.build_flags} ${stm32f4_I2C1.build_flags}
497497
extends = env:mks_robin_nano_v3_usb_flash_drive
498498
build_flags = ${env:mks_robin_nano_v3_usb_flash_drive.build_flags}
499499
-DUSBD_USE_CDC_MSC
500-
build_unflags = -DUSBD_USE_CDC
500+
build_unflags = ${env:mks_robin_nano_v3_usb_flash_drive.build_unflags}
501+
-DUSBD_USE_CDC
501502

502503
#
503504
# MKS Robin Nano V3_1
@@ -626,7 +627,7 @@ extends = TH3D_EZBoard_V2
626627
board_build.encode = firmware.bin
627628
board_build.offset = 0xC000
628629
board_upload.offset_address = 0x0800C000
629-
extra_scripts = ${stm32_variant.extra_scripts}
630+
extra_scripts = ${TH3D_EZBoard_V2.extra_scripts}
630631
buildroot/share/PlatformIO/scripts/openblt.py
631632

632633
[mks_robin_nano_v1_3_f4_common]
@@ -647,19 +648,19 @@ upload_protocol = jlink
647648
#
648649
[env:mks_robin_nano_v1_3_f4]
649650
extends = mks_robin_nano_v1_3_f4_common
650-
build_flags = ${stm32_variant.build_flags}
651+
build_flags = ${mks_robin_nano_v1_3_f4_common.build_flags}
651652
-DMCU_STM32F407VE -DENABLE_HWSERIAL3 -DSTM32_FLASH_SIZE=512
652653
-DTIMER_SERVO=TIM2 -DTIMER_TONE=TIM3 -DSS_TIMER=4
653654
-DHAL_SD_MODULE_ENABLED -DHAL_SRAM_MODULE_ENABLED
654-
build_unflags = ${stm32_variant.build_unflags}
655+
build_unflags = ${mks_robin_nano_v1_3_f4_common.build_unflags}
655656
-DUSBCON -DUSBD_USE_CDC
656657

657658
#
658659
# MKS/ZNP Robin Nano V1.3 with native USB mod
659660
#
660661
[env:mks_robin_nano_v1_3_f4_usbmod]
661662
extends = mks_robin_nano_v1_3_f4_common
662-
build_flags = ${stm32_variant.build_flags}
663+
build_flags = ${mks_robin_nano_v1_3_f4_common.build_flags}
663664
-DMCU_STM32F407VE -DSTM32_FLASH_SIZE=512
664665
-DTIMER_SERVO=TIM2 -DTIMER_TONE=TIM3 -DSS_TIMER=4
665666
-DHAL_SD_MODULE_ENABLED -DHAL_SRAM_MODULE_ENABLED

0 commit comments

Comments
 (0)
Please sign in to comment.