Skip to content

Commit

Permalink
Merge pull request #752 from Paciente8159/custom-board-overrides
Browse files Browse the repository at this point in the history
Custom board overrides
  • Loading branch information
Paciente8159 authored Sep 11, 2024
2 parents f58f622 + 58e002c commit 374df2e
Show file tree
Hide file tree
Showing 46 changed files with 247 additions and 513 deletions.
1 change: 1 addition & 0 deletions platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ monitor_speed = 115200
monitor_eol = LF
monitor_echo = yes
monitor_filters = colorize, time
board = ${webconfig.board}
build_flags =
${webconfig.build_flags}
; add your custom build flags
Expand Down
7 changes: 5 additions & 2 deletions uCNC/cnc_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,14 @@ extern "C"

/**
* Choose the board
* Check boards.h for list of available/supported boards
* Select the boardmap for your board.
* Boardmaps are available at src/hal/boards/
* Or you can create your custom boardmap
*
* */

#ifndef BOARD
#define BOARD BOARD_UNO
#define BOARD "src/hal/boards/avr/boardmap_uno.h"
#endif

// optional name to override default board name build info (if option enabled)
Expand Down
1 change: 0 additions & 1 deletion uCNC/src/cnc_hal_config_helper.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ extern "C"
#include "cnc_build.h"
// make the needed includes (do not change the order)
// include lists of available option
#include "hal/boards/boards.h"
#include "hal/mcus/mcus.h"
#include "hal/kinematics/kinematics.h"
// user configurations
Expand Down
24 changes: 14 additions & 10 deletions uCNC/src/hal/boards/avr/avr.ini
Original file line number Diff line number Diff line change
Expand Up @@ -18,36 +18,36 @@ lib_deps = ${env.lib_deps}
extends = common_avr
board = uno
;saves a bit of flash
build_flags = ${common_avr.build_flags} -D DISABLE_SETTINGS_MODULES -D DISABLE_MULTISTREAM_SERIAL
build_flags = ${common_avr.build_flags}

[atmega328pb]
extends = common_avr
board = Atmega328PB
;saves a bit of flash
platform_packages=platformio/framework-arduino-avr-minicore@^3.0.0
build_flags = ${common_avr.build_flags} -D DISABLE_SETTINGS_MODULES -D DISABLE_MULTISTREAM_SERIAL
build_flags = ${common_avr.build_flags}

[env:AVR-UNO]
extends = atmega328p
build_flags = ${atmega328p.build_flags} -D BOARD=BOARD_UNO
build_flags = ${atmega328p.build_flags} -D BOARD=\"src/hal/boards/avr/boardmap_uno.h\"

[env:AVR-CNC-Shield-V3]
extends = atmega328p
build_flags = ${atmega328p.build_flags} -D BOARD=BOARD_UNO_SHIELD_V3
build_flags = ${atmega328p.build_flags} -D BOARD=\"src/hal/boards/avr/boardmap_uno_shield_v3.h\"

[env:AVR-X-Controller]
extends = atmega328p
build_flags = ${atmega328p.build_flags} -D BOARD=BOARD_X_CONTROLLER
build_flags = ${atmega328p.build_flags} -D BOARD=\"src/hal/boards/avr/boardmap_x_controller.h\"

[env:AVR-MKS-DLC]
extends = atmega328p
board_build.f_cpu = 20000000UL
build_flags = ${atmega328p.build_flags} -D BOARD=BOARD_MKS_DLC
build_flags = ${atmega328p.build_flags} -D BOARD=\"src/hal/boards/avr/boardmap_mks_dlc.h\"

[env:AVR-MEGA2560-RAMPS-V1_4]
extends = common_avr
board = megaatmega2560
build_flags = ${common_avr.build_flags} -D BOARD=BOARD_RAMPS14
build_flags = ${common_avr.build_flags} -D BOARD=\"src/hal/boards/avr/boardmap_ramps14.h\"

; [env:ramps14mirror]
; extends = common_avr
Expand All @@ -57,15 +57,19 @@ build_flags = ${common_avr.build_flags} -D BOARD=BOARD_RAMPS14
[env:AVR-MKS-GEN-L-V1]
extends = common_avr
board = megaatmega2560
build_flags = ${common_avr.build_flags} -D BOARD=BOARD_MKS_GEN_L_V1
build_flags = ${common_avr.build_flags} -D BOARD=\"src/hal/boards/avr/boardmap_mks_gen_l_v1.h\"

[env:AVR-RAMBO]
extends = common_avr
board = megaatmega2560
build_flags = ${common_avr.build_flags} -D BOARD=BOARD_RAMBO14
build_flags = ${common_avr.build_flags} -D BOARD=\"src/hal/boards/avr/boardmap_rambo14.h\"

[env:AVR-MELZI-V1_1_4]
extends = common_avr
board = sanguino_atmega1284p
board_upload.maximum_size = 126976
build_flags = ${common_avr.build_flags} -D BOARD=BOARD_MELZI_V114
build_flags = ${common_avr.build_flags} -D BOARD=\"src/hal/boards/avr/boardmap_melzi_v114.h\"

[env:AVR-CUSTOM]
extends = common_avr
board = ${env.board}
6 changes: 4 additions & 2 deletions uCNC/src/hal/boards/avr/boardmap_melzi_v114.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,16 @@ extern "C"
{
#endif

#ifndef MCU
#define MCU MCU_AVR
#endif

#ifndef BOARD_NAME
#define BOARD_NAME "Melzi 1.1.4"
#endif

#define AVR6

#include "mega_ide_pins.h"

#define PCINT0_PORT A
#define PCINT1_PORT B
#define PCINT2_PORT C
Expand Down
4 changes: 4 additions & 0 deletions uCNC/src/hal/boards/avr/boardmap_mks_dlc.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ extern "C"
{
#endif

#ifndef MCU
#define MCU MCU_AVR
#endif

#ifndef BOARD_NAME
#define BOARD_NAME "MKS DLC"
#endif
Expand Down
4 changes: 4 additions & 0 deletions uCNC/src/hal/boards/avr/boardmap_mks_gen_l_v1.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ extern "C"
{
#endif

#ifndef MCU
#define MCU MCU_AVR
#endif

#ifndef BOARD_NAME
#define BOARD_NAME "MKS GEN L V1"
#endif
Expand Down
4 changes: 4 additions & 0 deletions uCNC/src/hal/boards/avr/boardmap_rambo14.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ extern "C"
{
#endif

#ifndef MCU
#define MCU MCU_AVR
#endif

#ifndef BOARD_NAME
#define BOARD_NAME "RAMBO 1.4"
#endif
Expand Down
6 changes: 4 additions & 2 deletions uCNC/src/hal/boards/avr/boardmap_ramps14.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,16 @@ extern "C"
{
#endif

#ifndef MCU
#define MCU MCU_AVR
#endif

#ifndef BOARD_NAME
#define BOARD_NAME "RAMPS 1.4"
#endif

#define AVR6

#include "mega_ide_pins.h"

#define PCINT0_PORT B
#define PCINT1_PORT J
#define PCINT2_PORT K
Expand Down
6 changes: 4 additions & 2 deletions uCNC/src/hal/boards/avr/boardmap_ramps14_mirror.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,16 @@ extern "C"
{
#endif

#ifndef MCU
#define MCU MCU_AVR
#endif

#ifndef BOARD_NAME
#define BOARD_NAME "RAMPS 1.4 MIRROR"
#endif

#define AVR6

#include "mega_ide_pins.h"

#define PCINT0_PORT B
#define PCINT1_PORT J
#define PCINT2_PORT K
Expand Down
16 changes: 12 additions & 4 deletions uCNC/src/hal/boards/avr/boardmap_uno.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ extern "C"
{
#endif

#ifndef MCU
#define MCU MCU_AVR
#endif

#ifndef BOARD_NAME
#define BOARD_NAME "Arduino UNO"
#endif
Expand Down Expand Up @@ -149,17 +153,21 @@ extern "C"
#define PLANNER_BUFFER_SIZE 14
#endif
// reduces ITP code size by avoiding some optimizations
#ifdef STEP_ISR_SKIP_MAIN
#undef STEP_ISR_SKIP_MAIN
#endif
#ifdef STEP_ISR_SKIP_IDLE
#undef STEP_ISR_SKIP_IDLE
#endif

#ifndef USE_MACRO_BUFFER
#define USE_MACRO_BUFFER
#endif

#ifndef DISABLE_SETTINGS_MODULES
#define DISABLE_SETTINGS_MODULES
#endif

#ifndef DISABLE_MULTISTREAM_SERIAL
#define DISABLE_MULTISTREAM_SERIAL
#endif

#ifdef __cplusplus
}
#endif
Expand Down
16 changes: 4 additions & 12 deletions uCNC/src/hal/boards/avr/boardmap_uno_shield_v3.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,31 +24,23 @@ extern "C"
{
#endif

#ifndef MCU
#define MCU MCU_AVR
#endif

#ifndef BOARD_NAME
#define BOARD_NAME "UNO SHIELD V3"
#endif

#include "boardmap_uno.h"

// swap limit z and replace pwm by spin enable pin
#ifdef LIMIT_Z_BIT
#undef LIMIT_Z_BIT
#endif
#ifdef LIMIT_Z_PORT
#undef LIMIT_Z_PORT
#endif
#ifdef PWM0_BIT
#undef PWM0_BIT
#endif
#ifdef PWM0_PORT
#undef PWM0_PORT
#endif
#ifdef PWM0_CHANNEL
#undef PWM0_CHANNEL
#endif
#ifdef PWM0_TIMER
#undef PWM0_TIMER
#endif

// Grbl 0.8 limit z
#define LIMIT_Z_BIT 3 // assigns LIMIT_Z pin
Expand Down
12 changes: 4 additions & 8 deletions uCNC/src/hal/boards/avr/boardmap_x_controller.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,25 +24,21 @@ extern "C"
{
#endif

#ifndef MCU
#define MCU MCU_AVR
#endif

#ifndef BOARD_NAME
#define BOARD_NAME "X CONTROLLER"
#endif

#include "boardmap_uno.h"

// free FHOLD and CS RES pins
#ifdef FHOLD_PORT
#undef FHOLD_PORT
#endif
#ifdef FHOLD_BIT
#undef FHOLD_BIT
#endif
#ifdef CS_RES_PORT
#undef CS_RES_PORT
#endif
#ifdef CS_RES_BIT
#undef CS_RES_BIT
#endif

#define INVERT_EMERGENCY_STOP

Expand Down
Loading

0 comments on commit 374df2e

Please sign in to comment.