Skip to content

Commit

Permalink
[WB32 MCU] Added RTC hal. (#399)
Browse files Browse the repository at this point in the history
* Fixed usb remote wakeup, i2c Added more rate configurations

* Added RTC configuration in hal_lld.h

* 初步测试通过 实现RTC功能

* update

* update rtc_lld

* UPDATE

* update

* update 正式版本2

* update 正式版

* update 正式发布

* update 正式发布

* update 3G71

* update

* update

* update

* update

* update

* update

* update

* update

* update

* Revert "Update keil project"

This reverts commit 2123167.

# Conflicts:
#	demos/WB32/RT-WB32FQ95-GENERIC/keil/ch.uvprojx

* update 修改格式

* Update demos/WB32/RT-WB32F3G71-RTC/debug.h

Co-authored-by: Joy Lee <joylee.lc@foxmail.com>

* Update demos/WB32/RT-WB32F3G71-RTC/main.c

Co-authored-by: Joy Lee <joylee.lc@foxmail.com>

* Update demos/WB32/RT-WB32F3G71-RTC/main.c

Co-authored-by: Joy Lee <joylee.lc@foxmail.com>

* Update demos/WB32/RT-WB32F3G71-RTC/main.c

Co-authored-by: Joy Lee <joylee.lc@foxmail.com>

* Revert "Update keil project"

This reverts commit 2123167.

# Conflicts:
#	demos/WB32/RT-WB32FQ95-GENERIC/keil/ch.uvprojx

* update

* update

* update

* update

* Update os/hal/ports/WB32/LLD/RTCv1/hal_rtc_lld.c

Co-authored-by: Joy Lee <joylee.lc@foxmail.com>

* Update os/hal/ports/WB32/LLD/RTCv1/hal_rtc_lld.c

Co-authored-by: Joy Lee <joylee.lc@foxmail.com>

* Update os/hal/ports/WB32/LLD/RTCv1/hal_rtc_lld.c

Co-authored-by: Joy Lee <joylee.lc@foxmail.com>

* Update os/hal/ports/WB32/LLD/RTCv1/hal_rtc_lld.c

Co-authored-by: Joy Lee <joylee.lc@foxmail.com>

* Update os/hal/ports/WB32/LLD/RTCv1/hal_rtc_lld.c

Co-authored-by: Joy Lee <joylee.lc@foxmail.com>

* UPDATE

* update

* update

* update

* update

* update

* Update hal_usb_lld.c

* Update

---------

Co-authored-by: bingkun.li <bingkun.li@westberrytech.com>
Co-authored-by: wind <108604699+yelishang@users.noreply.github.com>
Co-authored-by: wb <wb@westberrytech.com>
  • Loading branch information
4 people authored Apr 3, 2024
1 parent 554faef commit 77cb0a4
Show file tree
Hide file tree
Showing 35 changed files with 7,664 additions and 155 deletions.
204 changes: 204 additions & 0 deletions demos/WB32/RT-WB32F3G71-RTC/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,204 @@
##############################################################################
# Build global options
# NOTE: Can be overridden externally.
#

# Compiler options here.
ifeq ($(USE_OPT),)
USE_OPT = -O2 -ggdb -fomit-frame-pointer -falign-functions=16
endif

# C specific options here (added to USE_OPT).
ifeq ($(USE_COPT),)
USE_COPT =
endif

# C++ specific options here (added to USE_OPT).
ifeq ($(USE_CPPOPT),)
USE_CPPOPT = -fno-rtti
endif

# Enable this if you want the linker to remove unused code and data.
ifeq ($(USE_LINK_GC),)
USE_LINK_GC = yes
endif

# Linker extra options here.
ifeq ($(USE_LDOPT),)
USE_LDOPT =
endif

# Enable this if you want link time optimizations (LTO).
ifeq ($(USE_LTO),)
USE_LTO = yes
endif

# Enable this if you want to see the full log while compiling.
ifeq ($(USE_VERBOSE_COMPILE),)
USE_VERBOSE_COMPILE = yes
endif

# If enabled, this option makes the build process faster by not compiling
# modules not used in the current configuration.
ifeq ($(USE_SMART_BUILD),)
USE_SMART_BUILD = yes
endif

#
# Build global options
##############################################################################

##############################################################################
# Architecture or project specific options
#

# Stack size to be allocated to the Cortex-M process stack. This stack is
# the stack used by the main() thread.
ifeq ($(USE_PROCESS_STACKSIZE),)
USE_PROCESS_STACKSIZE = 0x400
endif

# Stack size to the allocated to the Cortex-M main/exceptions stack. This
# stack is used for processing interrupts and exceptions.
ifeq ($(USE_EXCEPTIONS_STACKSIZE),)
USE_EXCEPTIONS_STACKSIZE = 0x400
endif

# Enables the use of FPU (no, softfp, hard).
ifeq ($(USE_FPU),)
USE_FPU = no
endif

# FPU-related options.
ifeq ($(USE_FPU_OPT),)
USE_FPU_OPT = -mfloat-abi=$(USE_FPU) -mfpu=fpv4-sp-d16
endif

#
# Architecture or project specific options
##############################################################################

##############################################################################
# Project, target, sources and paths
#

# Define project name here
PROJECT = ch

# Target settings.
MCU = cortex-m3

# Imported source files and paths.
CHIBIOS := ../../../../ChibiOS
CHIBIOS_CONTRIB = $(CHIBIOS)/../ChibiOS-Contrib
CONFDIR := ./cfg
BUILDDIR := ./build
DEPDIR := ./.dep
BOARDDIR := ./board

# Licensing files.
include $(CHIBIOS)/os/license/license.mk
# Startup files.
include $(CHIBIOS_CONTRIB)/os/common/startup/ARMCMx/compilers/GCC/mk/startup_wb32f3g71xx.mk
# HAL-OSAL files (optional).
include $(CHIBIOS)/os/hal/hal.mk
include $(CHIBIOS_CONTRIB)/os/hal/ports/WB32/WB32F3G71xx/platform.mk
include $(BOARDDIR)/board.mk
include $(CHIBIOS)/os/hal/osal/rt-nil/osal.mk
# RTOS files (optional).
include $(CHIBIOS)/os/rt/rt.mk
include $(CHIBIOS)/os/common/ports/ARMv7-M/compilers/GCC/mk/port.mk
# Auto-build files in ./source recursively.
include $(CHIBIOS)/tools/mk/autobuild.mk
# Other files (optional).
# include $(CHIBIOS)/test/lib/test.mk
# include $(CHIBIOS)/test/rt/rt_test.mk
# include $(CHIBIOS)/test/oslib/oslib_test.mk
# include $(CHIBIOS)/os/hal/lib/streams/streams.mk
# include $(CHIBIOS)/os/various/shell/shell.mk

# Define linker script file here
LDSCRIPT= $(STARTUPLD_CONTRIB)/WB32F3G71xC.ld


# C sources that can be compiled in ARM or THUMB mode depending on the global
# setting.
CSRC = $(ALLCSRC) \
$(TESTSRC) \
$(CHIBIOS)/os/various/syscalls.c \
$(CHIBIOS)/os/hal/lib/streams/chprintf.c \
debug.c \
main.c

ALLINC += ./ \
$(CHIBIOS)/os/common/lib/include \
$(CHIBIOS)/os/common/oop/include \
$(CHIBIOS)/os/hal/lib/streams



# C++ sources that can be compiled in ARM or THUMB mode depending on the global
# setting.
CPPSRC = $(ALLCPPSRC)

# List ASM source files here.
ASMSRC = $(ALLASMSRC)

# List ASM with preprocessor source files here.
ASMXSRC = $(ALLXASMSRC)

# Inclusion directories.
INCDIR = $(CONFDIR) $(ALLINC) $(TESTINC)

# Define C warning options here.
CWARN = -Wall -Wextra -Wundef -Wstrict-prototypes

# Define C++ warning options here.
CPPWARN = -Wall -Wextra -Wundef

#
# Project, target, sources and paths
##############################################################################

##############################################################################
# Start of user section
#

# List all user C define here, like -D_DEBUG=1
UDEFS =

# Define ASM defines here
UADEFS =

# List all user directories here
UINCDIR =

# List the user directory to look for the libraries here
ULIBDIR =

# List all user libraries here
ULIBS =

#
# End of user section
##############################################################################

##############################################################################
# Common rules
#

RULESPATH = $(CHIBIOS)/os/common/startup/ARMCMx/compilers/GCC/mk
include $(RULESPATH)/arm-none-eabi.mk
include $(RULESPATH)/rules.mk

#
# Common rules
##############################################################################

##############################################################################
# Custom rules
#

#
# Custom rules
##############################################################################
82 changes: 82 additions & 0 deletions demos/WB32/RT-WB32F3G71-RTC/board/board.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
/*
Copyright (C) 2023 Westberry Technology Corp., Ltd
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

/*
* This file has been automatically generated using ChibiStudio board
* generator plugin. Do not edit manually.
*/

#include "hal.h"

/*===========================================================================*/
/* Driver local definitions. */
/*===========================================================================*/

/*===========================================================================*/
/* Driver exported variables. */
/*===========================================================================*/

/*===========================================================================*/
/* Driver local variables and types. */
/*===========================================================================*/

/*===========================================================================*/
/* Driver local functions. */
/*===========================================================================*/

static void wb32_gpio_init(void) {

#if WB32_HAS_GPIOA
rccEnableAPB1(RCC_APB1ENR_GPIOAEN);
#endif

#if WB32_HAS_GPIOB
rccEnableAPB1(RCC_APB1ENR_GPIOBEN);
#endif

#if WB32_HAS_GPIOC
rccEnableAPB1(RCC_APB1ENR_GPIOCEN);
#endif

#if WB32_HAS_GPIOD
rccEnableAPB1(RCC_APB1ENR_GPIODEN);
#endif
}

/*===========================================================================*/
/* Driver interrupt handlers. */
/*===========================================================================*/

/*===========================================================================*/
/* Driver exported functions. */
/*===========================================================================*/
/*
* Early initialization code.
* This initialization must be performed just after stack setup and before
* any other initialization.
*/
void __early_init(void) {

wb32_clock_init();
wb32_gpio_init();
}
/**
* @brief Board-specific initialization code.
* @note You can add your board-specific code here.
*/
void boardInit(void) {

}
56 changes: 56 additions & 0 deletions demos/WB32/RT-WB32F3G71-RTC/board/board.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
#pragma once
/*
Copyright (C) 2023 Westberry Technology Corp., Ltd
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

/*
* This file has been automatically generated using ChibiStudio board
* generator plugin. Do not edit manually.
*/

#ifndef BOARD_H
#define BOARD_H

/*===========================================================================*/
/* Driver constants. */
/*===========================================================================*/

/*
* Setup board.
*/

/*
* Board identifier.
*/
#define WB32FQ95xC
#if !defined(WB32F3G71xx)
#define WB32F3G71xx
#endif

/*===========================================================================*/
/* External declarations. */
/*===========================================================================*/

#if !defined(_FROM_ASM_)
#ifdef __cplusplus
extern "C" {
#endif
void boardInit(void);
#ifdef __cplusplus
}
#endif
#endif /* _FROM_ASM_ */

#endif /* BOARD_H */
9 changes: 9 additions & 0 deletions demos/WB32/RT-WB32F3G71-RTC/board/board.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# List of all the board related files.
BOARDSRC = $(BOARDDIR)/board.c

# Required include directories
BOARDINC = $(BOARDDIR)

# Shared variables
ALLCSRC += $(BOARDSRC)
ALLINC += $(BOARDINC)
Loading

0 comments on commit 77cb0a4

Please sign in to comment.