Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for the Growatt ShineLAN-X board #56

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
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
7 changes: 7 additions & 0 deletions release.Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ all: dapboot-bluepill.bin \
dapboot-olimexstm32h103.bin \
dapboot-bluepillplusstm32.bin \
dapboot-bttskrminie3v2.bin \
dapboot-shinelanx.bin \
dapboot-bluepill-high.bin \
dapboot-maplemini-high.bin \
dapboot-stlink-high.bin \
Expand Down Expand Up @@ -92,6 +93,12 @@ dapboot-bttskrminie3v2.bin: | $(BUILD_DIR)
$(Q)$(MAKE) TARGET=BTTSKRMINIE3V2 -C src/
$(Q)cp src/dapboot.bin $(BUILD_DIR)/$(@)

dapboot-shinelanx.bin: | $(BUILD_DIR)
@printf " BUILD $(@)\n"
$(Q)$(MAKE) TARGET=SHINELANX -C src/ clean
$(Q)$(MAKE) TARGET=SHINELANX -C src/
$(Q)cp src/dapboot.bin $(BUILD_DIR)/$(@)

dapboot-bluepill-high.bin: | $(BUILD_DIR)
@printf " BUILD $(@)\n"
$(Q)$(MAKE) TARGET=BLUEPILL_HIGH -C src/ clean
Expand Down
48 changes: 48 additions & 0 deletions src/stm32f103/shinelanx/config.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/*
* Permission to use, copy, modify, and/or distribute this software
* for any purpose with or without fee is hereby granted, provided
* that the above copyright notice and this permission notice
* appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
* LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
* NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/

#ifndef CONFIG_H_INCLUDED
#define CONFIG_H_INCLUDED

#define APP_BASE_ADDRESS (0x08000000 + BOOTLOADER_OFFSET)
#define FLASH_PAGE_SIZE 2048
#define DFU_UPLOAD_AVAILABLE 1
#define DFU_DOWNLOAD_AVAILABLE 1

#define HAVE_LED 1
#define LED_OPEN_DRAIN 0
#define LED_ACTIVE_HIGH 1
#define LED_GPIO_PORT GPIOC
#define LED_GPIO_PIN GPIO7

#define HAVE_BUTTON 1
#define BUTTON_ACTIVE_HIGH 0
#define BUTTON_GPIO_PORT GPIOA
#define BUTTON_GPIO_PIN GPIO3
#define BUTTON_USES_PULL 0

#define BUTTON_SAMPLE_DELAY_CYCLES 1440000

#define HAVE_USB_PULLUP_CONTROL 1
#define USB_PULLUP_GPIO_PORT GPIOA
#define USB_PULLUP_GPIO_PIN GPIO8
#define USB_PULLUP_ACTIVE_HIGH 0
#define USB_PULLUP_OPEN_DRAIN 1

#define USES_GPIOA 1
#define USES_GPIOC 1

#endif
10 changes: 9 additions & 1 deletion src/stm32f103/target_stm32f103.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@
#define BUTTON_USES_PULL 1
#endif

#ifndef LED_ACTIVE_HIGH
#define LED_ACTIVE_HIGH 0
#endif

#ifdef FLASH_SIZE_OVERRIDE
_Static_assert((FLASH_BASE + FLASH_SIZE_OVERRIDE >= APP_BASE_ADDRESS),
"Incompatible flash size");
Expand Down Expand Up @@ -107,7 +111,11 @@ void target_gpio_setup(void) {
if (LED_OPEN_DRAIN) {
gpio_set(LED_GPIO_PORT, LED_GPIO_PIN);
} else {
gpio_clear(LED_GPIO_PORT, LED_GPIO_PIN);
if (LED_ACTIVE_HIGH) {
gpio_set(LED_GPIO_PORT, LED_GPIO_PIN);
} else {
gpio_clear(LED_GPIO_PORT, LED_GPIO_PIN);
}
}
gpio_set_mode(LED_GPIO_PORT, mode, conf, LED_GPIO_PIN);
}
Expand Down
13 changes: 13 additions & 0 deletions src/targets.mk
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,19 @@ ifeq ($(TARGET),BTTSKRMINIE3V2_HIGH_256)
ARCH = STM32F1
DEFS += -DBOOTLOADER_HIGH
endif
ifeq ($(TARGET),SHINELANX)
TARGET_COMMON_DIR := ./stm32f103
TARGET_SPEC_DIR := ./stm32f103/shinelanx
LDSCRIPT := ./stm32f103/stm32f103x8.ld
ARCH = STM32F1
endif
ifeq ($(TARGET),SHINELANX_HIGH_256)
TARGET_COMMON_DIR := ./stm32f103
TARGET_SPEC_DIR := ./stm32f103/shinelanx
LDSCRIPT := ./stm32f103/stm32f103xc_high.ld
ARCH = STM32F1
DEFS += -DBOOTLOADER_HIGH
endif
ifeq ($(TARGET),STM32L1_GENERIC)
TARGET_COMMON_DIR := ./stm32l1
TARGET_SPEC_DIR := ./stm32l1/generic
Expand Down