mirror of
https://github.com/openmv/openmv.git
synced 2025-11-04 14:49:50 +08:00
commit
f2e58f5200
@ -17,6 +17,7 @@ SRC_C += $(addprefix $(HAL_DIR)/src/, \
|
||||
stm32h7xx_hal_rcc_ex.c \
|
||||
stm32h7xx_hal_rtc.c \
|
||||
stm32h7xx_hal_rtc_ex.c \
|
||||
stm32h7xx_hal_hsem.c \
|
||||
)
|
||||
#SRCS += $(addprefix $(HAL_DIR)/src/, $(notdir $(wildcard ../$(HAL_DIR)/src/*.c)))
|
||||
|
||||
|
||||
@ -1,14 +1,64 @@
|
||||
#include STM32_HAL_H
|
||||
#define HSEM_ID_0 (0U) /* HW semaphore 0*/
|
||||
#define LED_RED GPIO_PIN_5
|
||||
#define LED_GREEN GPIO_PIN_6
|
||||
#define LED_BLUE GPIO_PIN_7
|
||||
|
||||
void blink_led(uint32_t led)
|
||||
{
|
||||
__GPIOK_CLK_ENABLE();
|
||||
GPIO_InitTypeDef GPIO_InitStructure;
|
||||
GPIO_InitStructure.Pin = led;
|
||||
GPIO_InitStructure.Pull = GPIO_PULLDOWN;
|
||||
GPIO_InitStructure.Mode = GPIO_MODE_OUTPUT_PP;
|
||||
GPIO_InitStructure.Speed = GPIO_SPEED_LOW;
|
||||
HAL_GPIO_Init(GPIOK, &GPIO_InitStructure);
|
||||
HAL_GPIO_WritePin(GPIOK, led, GPIO_PIN_SET);
|
||||
|
||||
for (int i=0; i<5; i++) {
|
||||
HAL_GPIO_WritePin(GPIOK, led, GPIO_PIN_RESET);
|
||||
HAL_Delay(100);
|
||||
HAL_GPIO_WritePin(GPIOK, led, GPIO_PIN_SET);
|
||||
HAL_Delay(100);
|
||||
}
|
||||
__GPIOK_CLK_DISABLE();
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
__disable_irq();
|
||||
HAL_Init();
|
||||
|
||||
blink_led(LED_GREEN);
|
||||
|
||||
// HW semaphore Clock enable
|
||||
__HAL_RCC_HSEM_CLK_ENABLE();
|
||||
|
||||
// Configure the NVIC HSEM notification interrupt for CM4
|
||||
HAL_NVIC_SetPriority(HSEM2_IRQn, 0, 0);
|
||||
HAL_NVIC_EnableIRQ(HSEM2_IRQn);
|
||||
|
||||
// Activate HSEM notification for Cortex-M4
|
||||
HAL_HSEM_ActivateNotification(__HAL_HSEM_SEMID_TO_MASK(HSEM_ID_0));
|
||||
|
||||
// Add Cortex-M4 code here.
|
||||
HAL_PWREx_ClearPendingEvent();
|
||||
HAL_PWREx_EnterSTOPMode(PWR_MAINREGULATOR_ON, PWR_STOPENTRY_WFE, PWR_D2_DOMAIN);
|
||||
|
||||
HAL_PWREx_ClearPendingEvent();
|
||||
|
||||
// Deactivate HSEM notification for Cortex-M4
|
||||
HAL_HSEM_DeactivateNotification(__HAL_HSEM_SEMID_TO_MASK(HSEM_ID_0));
|
||||
|
||||
// HW semaphore Clock disable
|
||||
__HAL_RCC_HSEM_CLK_DISABLE();
|
||||
|
||||
// Enter D3 domain to DStandby mode
|
||||
HAL_PWREx_EnterSTANDBYMode(PWR_D3_DOMAIN);
|
||||
|
||||
// Enter D2 domain to DStandby mode
|
||||
HAL_PWREx_EnterSTANDBYMode(PWR_D2_DOMAIN);
|
||||
|
||||
HAL_Init();
|
||||
while (1) {
|
||||
__WFI();
|
||||
blink_led(LED_RED);
|
||||
}
|
||||
}
|
||||
|
||||
@ -125,9 +125,13 @@ void SysTick_Handler(void)
|
||||
*/
|
||||
void HSEM2_IRQHandler(void)
|
||||
{
|
||||
|
||||
HAL_HSEM_IRQHandler();
|
||||
}
|
||||
|
||||
void RTC_WKUP_IRQHandler(void)
|
||||
{
|
||||
|
||||
}
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
@ -24,6 +24,7 @@ stm32h7xx_hal_flash.c\
|
||||
stm32h7xx_hal_flash_ex.c\
|
||||
stm32h7xx_hal_gpio.c\
|
||||
stm32h7xx_hal_hcd.c\
|
||||
stm32h7xx_hal_hsem.c\
|
||||
stm32h7xx_hal_i2c.c\
|
||||
stm32h7xx_hal_i2c_ex.c\
|
||||
stm32h7xx_hal_ltdc.c\
|
||||
|
||||
@ -68,6 +68,11 @@ endif
|
||||
|
||||
ifeq ($(OMV_ENABLE_CM4), 1)
|
||||
CFLAGS += -DM4_APP_ADDR=$(M4_APP_ADDR)
|
||||
ifeq ($(DEBUG), 1)
|
||||
CM4_CFLAGS += -Og -ggdb3 -Wno-maybe-uninitialized
|
||||
else
|
||||
CM4_CFLAGS += -O2 -DNDEBUG
|
||||
endif
|
||||
CM4_CFLAGS += -std=gnu99 -Wall -Werror -Warray-bounds -mthumb -nostartfiles -fdata-sections -ffunction-sections
|
||||
CM4_CFLAGS += -D$(MCU) -D$(CFLAGS_MCU) -D$(ARM_MATH) -DARM_NN_TRUNCATE -DCORE_CM4\
|
||||
-fsingle-precision-constant -Wdouble-promotion -mcpu=cortex-m4 -mtune=cortex-m4 -mfpu=$(FPU) -mfloat-abi=hard
|
||||
|
||||
Loading…
Reference in New Issue
Block a user