Skip to content

Commit

Permalink
Add NEUTRONRCF435 support including AT32F435RGT7 1M FLASH
Browse files Browse the repository at this point in the history
  • Loading branch information
SteveCEvans committed Mar 17, 2023
1 parent 6ff80a4 commit 86862e8
Show file tree
Hide file tree
Showing 9 changed files with 119 additions and 8 deletions.
4 changes: 4 additions & 0 deletions make/mcu/AT32F4.mk
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,11 @@ INCLUDE_DIRS := $(INCLUDE_DIRS) \
$(MIDDLEWARES_DIR)/usbd_class/msc \
$(VCP_INCLUDES)

ifeq ($(TARGET_MCU),AT32F435ZMT7)
LD_SCRIPT = $(LINKER_DIR)/at32_flash_f43xM.ld
else
LD_SCRIPT = $(LINKER_DIR)/at32_flash_f43xG.ld
endif

ARCH_FLAGS = -std=c99 -mthumb -mcpu=cortex-m4 -march=armv7e-m -mfloat-abi=hard -mfpu=fpv4-sp-d16 -fsingle-precision-constant -Wdouble-promotion
DEVICE_FLAGS += -DUSE_ATBSP_DRIVER -DAT32F43x -DHSE_VALUE=$(HSE_VALUE) -DAT32 -DUSE_OTG_HOST_MODE
Expand Down
2 changes: 1 addition & 1 deletion src/config/ATSTARTF435/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
* If not, see <http://www.gnu.org/licenses/>.
*/

#define FC_TARGET_MCU AT32F435
#define FC_TARGET_MCU AT32F435_4M

#define BOARD_NAME ATSTARTF435
#define MANUFACTURER_ID AT
Expand Down
67 changes: 67 additions & 0 deletions src/config/NEUTRONRCF435/config.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
/*
* This file is part of Betaflight.
*
* Betaflight is free software. You can redistribute this software
* and/or modify this software under the terms of the GNU General
* Public License as published by the Free Software Foundation,
* either version 3 of the License, or (at your option) any later
* version.
*
* Betaflight is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this software.
*
* If not, see <http://www.gnu.org/licenses/>.
*/

#define FC_TARGET_MCU AT32F435

#define BOARD_NAME NEUTRONRCF435
#define MANUFACTURER_ID NERC

#define LED0_PIN PC4

#define USE_GYRO
#define USE_ACC
#define USE_ACCGYRO_BMI270
#define GYRO_1_CS_PIN PA15
#define GYRO_1_SPI_INSTANCE SPI1
#define GYRO_1_ALIGN CW270_DEG

// MPU6000 interrupts
#define USE_EXTI
#define USE_GYRO_EXTI
#define GYRO_1_EXTI_PIN PB8

#define SPI1_SCK_PIN PA5
#define SPI2_SCK_PIN PB13
#define SPI3_SCK_PIN PB3
#define SPI1_SDI_PIN PA6
#define SPI2_SDI_PIN PB14
#define SPI3_SDI_PIN PB4
#define SPI1_SDO_PIN PA7
#define SPI2_SDO_PIN PB15
#define SPI3_SDO_PIN PB5

#define USE_FLASH
#define USE_FLASH_W25Q128FV
#define FLASH_CS_PIN PB9
#define FLASH_SPI_INSTANCE SPI3

#define I2C2_SCL_PIN PB10
#define I2C2_SDA_PIN PB11

#define BARO_I2C_INSTANCE I2CDEV_2
#define USE_BARO
#define USE_BARO_BMP280

#define USE_OSD_SD
#define USE_MAX7456
#define MAX7456_SPI_INSTANCE SPI2
#define MAX7456_SPI_CS_PIN PB12

41 changes: 41 additions & 0 deletions src/link/at32_flash_f43xG.ld
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/*
*****************************************************************************
**
** File : at32_flash_f43xG.ld
**
** Abstract : Linker script for AT32F435/7xG Device with
** 1024KByte FLASH, 384KByte RAM
**
** Set heap size, stack size and stack location according
** to application requirements.
**
** Set memory bank area and size if external memory is used.
**
** Target : Artery Tek AT32
**
** Environment : Arm gcc toolchain
**
*****************************************************************************
*/

/*
FLASH : 0x0800 0000 -- 0x083E FFFF
MEM : 0x2000 0000 -- 0x2007 FFFF
*/

MEMORY
{
FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 16K
FLASH_CONFIG (r) : ORIGIN = 0x08004000, LENGTH = 16K
FLASH1 (rx) : ORIGIN = 0x08008000, LENGTH = 992K
SYSTEM_MEMORY (rx) : ORIGIN = 0x1FFF0000, LENGTH = 16K
RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 192K
MEMORY_B1 (rx) : ORIGIN = 0x60000000, LENGTH = 0K /* external ram */
}

REGION_ALIAS("STACKRAM", RAM)
REGION_ALIAS("VECTAB", RAM)

REGION_ALIAS("MOVABLE_FLASH", FLASH1)

INCLUDE "at32_flash_f4_split.ld"
2 changes: 1 addition & 1 deletion src/link/at32_flash_f4_split.ld
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
**
** File : at32_flash_f4_split.ld
**
** Abstract : Common linker script for STM32 devices.
** Abstract : Common linker script for AT32 devices.
**
*****************************************************************************
*/
Expand Down
2 changes: 1 addition & 1 deletion src/main/config/config_streamer.c
Original file line number Diff line number Diff line change
Expand Up @@ -513,7 +513,7 @@ int config_streamer_flush(config_streamer_t *c)
c->err = write_word(c, &c->buffer.w);
c->at = 0;
}
return c-> err;
return c->err;
}

int config_streamer_finish(config_streamer_t *c)
Expand Down
2 changes: 1 addition & 1 deletion src/main/drivers/at32/platform_mcu.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

#pragma once

#if defined(AT32F435ZMT7)
#if defined(AT32F435)

#include "at32f435_437.h"
#include "at32f435_437_i2c.h"
Expand Down
2 changes: 1 addition & 1 deletion src/main/target/AT32F435/target.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,4 +93,4 @@
// #undef USE_SERIAL_4WAY_BLHELI_BOOTLOADER
#undef USE_SERIAL_4WAY_SK_BOOTLOADER

#define FLASH_PAGE_SIZE ((uint32_t)0x1000) // 4K sectors
#define FLASH_PAGE_SIZE ((uint32_t)0x0800) // 2K sectors
5 changes: 2 additions & 3 deletions src/main/target/AT32F435/target.mk
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
TARGET_MCU := AT32F435
MCU_FLASH_SIZE := 4032
DEVICE_FLAGS = -DAT32F435ZMT7
MCU_FLASH_SIZE := 1024
DEVICE_FLAGS = -DAT32F435RGT7
TARGET_MCU_FAMILY := AT32F4

0 comments on commit 86862e8

Please sign in to comment.