master
张程凯 2022-01-11 19:51:25 +08:00
parent 456c9c0f6d
commit c864a99024
11 changed files with 107 additions and 117 deletions

67
.config
View File

@ -15,7 +15,7 @@ CONFIG_RT_THREAD_PRIORITY_32=y
# CONFIG_RT_THREAD_PRIORITY_256 is not set
CONFIG_RT_THREAD_PRIORITY_MAX=32
CONFIG_RT_TICK_PER_SECOND=1000
CONFIG_RT_USING_OVERFLOW_CHECK=y
# CONFIG_RT_USING_OVERFLOW_CHECK is not set
CONFIG_RT_USING_HOOK=y
CONFIG_RT_USING_IDLE_HOOK=y
CONFIG_RT_IDLE_HOOK_LIST_SIZE=4
@ -100,7 +100,7 @@ CONFIG_RT_USING_MSH=y
CONFIG_FINSH_USING_MSH=y
CONFIG_FINSH_THREAD_NAME="tshell"
CONFIG_FINSH_THREAD_PRIORITY=20
CONFIG_FINSH_THREAD_STACK_SIZE=512
CONFIG_FINSH_THREAD_STACK_SIZE=1024
CONFIG_FINSH_USING_HISTORY=y
CONFIG_FINSH_HISTORY_LINES=5
CONFIG_FINSH_USING_SYMTAB=y
@ -220,7 +220,7 @@ CONFIG_ULOG_OUTPUT_TIME=y
# CONFIG_ULOG_TIME_USING_TIMESTAMP is not set
CONFIG_ULOG_OUTPUT_LEVEL=y
CONFIG_ULOG_OUTPUT_TAG=y
# CONFIG_ULOG_OUTPUT_THREAD_NAME is not set
CONFIG_ULOG_OUTPUT_THREAD_NAME=y
CONFIG_ULOG_BACKEND_USING_CONSOLE=y
# CONFIG_ULOG_USING_FILTER is not set
# CONFIG_ULOG_USING_SYSLOG is not set
@ -337,7 +337,6 @@ CONFIG_ULOG_BACKEND_USING_CONSOLE=y
#
# language packages
#
# CONFIG_PKG_USING_LUATOS_SOC is not set
# CONFIG_PKG_USING_LUA is not set
# CONFIG_PKG_USING_JERRYSCRIPT is not set
# CONFIG_PKG_USING_MICROPYTHON is not set
@ -386,63 +385,13 @@ CONFIG_ULOG_BACKEND_USING_CONSOLE=y
# tools packages
#
# CONFIG_PKG_USING_CMBACKTRACE is not set
CONFIG_PKG_USING_EASYFLASH=y
CONFIG_PKG_EASYFLASH_PATH="/packages/tools/EasyFlash"
CONFIG_PKG_EASYFLASH_ENV=y
# CONFIG_PKG_EASYFLASH_ENV_AUTO_UPDATE is not set
# CONFIG_PKG_EASYFLASH_LOG is not set
# CONFIG_PKG_EASYFLASH_IAP is not set
CONFIG_PKG_EASYFLASH_ERASE_GRAN=4096
CONFIG_PKG_EASYFLASH_WRITE_GRAN_1BIT=y
# CONFIG_PKG_EASYFLASH_WRITE_GRAN_8BITS is not set
# CONFIG_PKG_EASYFLASH_WRITE_GRAN_32BITS is not set
CONFIG_PKG_EASYFLASH_WRITE_GRAN=1
CONFIG_PKG_EASYFLASH_START_ADDR=0
CONFIG_PKG_EASYFLASH_DEBUG=y
CONFIG_PKG_USING_EASYFLASH_V410=y
# CONFIG_PKG_USING_EASYFLASH_V400 is not set
# CONFIG_PKG_USING_EASYFLASH_V330 is not set
# CONFIG_PKG_USING_EASYFLASH_V321 is not set
# CONFIG_PKG_USING_EASYFLASH_V310 is not set
# CONFIG_PKG_USING_EASYFLASH_V300 is not set
# CONFIG_PKG_USING_EASYFLASH_LATEST_VERSION is not set
CONFIG_PKG_EASYFLASH_VER="v4.1.0"
CONFIG_PKG_EASYFLASH_VER_NUM=0x40100
CONFIG_PKG_USING_EASYLOGGER=y
#
# EasyLogger Options
#
CONFIG_PKG_EASYLOGGER_ENABLE_OUTPUT=y
# CONFIG_PKG_EASYLOGGER_OUTPUT_LVL_ASSERT is not set
# CONFIG_PKG_EASYLOGGER_OUTPUT_LVL_ERROR is not set
# CONFIG_PKG_EASYLOGGER_OUTPUT_LVL_WARN is not set
# CONFIG_PKG_EASYLOGGER_OUTPUT_LVL_INFO is not set
CONFIG_PKG_EASYLOGGER_OUTPUT_LVL_VERBOSE=y
CONFIG_PKG_EASYLOGGER_ENABLE_ASSERT=y
CONFIG_PKG_EASYLOGGER_LINE_BUF_SIZE=256
CONFIG_PKG_EASYLOGGER_FILTER_TAG_MAX_LEN=30
CONFIG_PKG_EASYLOGGER_FILTER_KW_MAX_LEN=16
CONFIG_PKG_EASYLOGGER_NEWLINE_SIGN_CRLF=y
# CONFIG_PKG_EASYLOGGER_NEWLINE_SIGN_LF is not set
# CONFIG_PKG_EASYLOGGER_NEWLINE_SIGN_CR is not set
CONFIG_PKG_EASYLOGGER_ENABLE_COLOR=y
# CONFIG_PKG_EASYLOGGER_ENABLE_ASYNC_OUTPUT is not set
# CONFIG_PKG_EASYLOGGER_ENABLE_PLUGIN_FLASH is not set
CONFIG_PKG_EASYLOGGER_PATH="/packages/tools/EasyLogger"
CONFIG_PKG_USING_EASYLOGGER_V200=y
# CONFIG_PKG_USING_EASYLOGGER_LATEST_VERSION is not set
CONFIG_PKG_EASYLOGGER_VER="v2.0.0"
# CONFIG_PKG_USING_EASYFLASH is not set
# CONFIG_PKG_USING_EASYLOGGER is not set
# CONFIG_PKG_USING_SYSTEMVIEW is not set
# CONFIG_PKG_USING_SEGGER_RTT is not set
# CONFIG_PKG_USING_RDB is not set
# CONFIG_PKG_USING_QRCODE is not set
CONFIG_PKG_USING_ULOG_EASYFLASH=y
CONFIG_PKG_ULOG_EASYFLASH_PATH="/packages/tools/ulog_easyflash"
CONFIG_PKG_USING_ULOG_EASYFLASH_V00200=y
# CONFIG_PKG_USING_ULOG_EASYFLASH_V00100 is not set
# CONFIG_PKG_USING_ULOG_EASYFLASH_LATEST_VERSION is not set
CONFIG_PKG_ULOG_EASYFLASH_VER="v0.2.0"
# CONFIG_PKG_USING_ULOG_EASYFLASH is not set
# CONFIG_PKG_USING_ULOG_FILE is not set
# CONFIG_PKG_USING_LOGMGR is not set
# CONFIG_PKG_USING_ADBD is not set
@ -491,7 +440,6 @@ CONFIG_PKG_ULOG_EASYFLASH_VER="v0.2.0"
#
# CONFIG_PKG_USING_POSIX_GETLINE is not set
# CONFIG_PKG_USING_POSIX_WCWIDTH is not set
# CONFIG_PKG_USING_POSIX_ITOA is not set
#
# acceleration: Assembly language or algorithmic acceleration packages
@ -560,6 +508,7 @@ CONFIG_PKG_CMSIS_RTOS2_VER="latest"
# CONFIG_PKG_USING_MCUBOOT is not set
# CONFIG_PKG_USING_TINYUSB is not set
# CONFIG_PKG_USING_USB_STACK is not set
# CONFIG_PKG_USING_LUATOS_SOC is not set
#
# peripheral libraries and drivers
@ -616,7 +565,6 @@ CONFIG_PKG_CMSIS_RTOS2_VER="latest"
# CONFIG_PKG_USING_SSD1306 is not set
# CONFIG_PKG_USING_QKEY is not set
# CONFIG_PKG_USING_RS485 is not set
# CONFIG_PKG_USING_RS232 is not set
# CONFIG_PKG_USING_NES is not set
# CONFIG_PKG_USING_VIRTUAL_SENSOR is not set
# CONFIG_PKG_USING_VDEVICE is not set
@ -638,7 +586,6 @@ CONFIG_PKG_CMSIS_RTOS2_VER="latest"
# CONFIG_PKG_USING_BL_MCU_SDK is not set
# CONFIG_PKG_USING_SOFT_SERIAL is not set
# CONFIG_PKG_USING_MB85RS16 is not set
# CONFIG_PKG_USING_CW2015 is not set
#
# AI packages

View File

@ -1,3 +1,10 @@
/*
* @Description:
* @Date: 2022-01-10 17:05:41
* @LastEditors: CK.Zh
* @LastEditTime: 2022-01-11 18:26:46
* @FilePath: /motion_ec/Libraries/CMSIS/Device/HDSC/HC32L073/Include/system_hc32l07x.h
*/
/*******************************************************************************
* Copyright (C) 2019, Huada Semiconductor Co.,Ltd All rights reserved.
*
@ -78,8 +85,8 @@ extern "C" {
#define CLOCK_SETTING_NONE 0u
#define CLOCK_SETTING_CMSIS 1u
#define HC32L07xPxxx //100PIN
//#define HC32L07xKxxx //64PIN
// #define HC32L07xPxxx //100PIN
#define HC32L07xKxxx //64PIN
//#define HC32L07xJxxx //48PIN
/******************************************************************************/

View File

@ -2,7 +2,7 @@
* @Description:
* @Date: 2022-01-06 14:31:32
* @LastEditors: CK.Zh
* @LastEditTime: 2022-01-11 11:35:17
* @LastEditTime: 2022-01-11 19:51:15
* @FilePath: /motion_ec/README.md
-->
# Motion EC 说明
@ -37,4 +37,3 @@ Motion计算机常用 **板载资源** 如下:
* 工程配置: `scons --menuconfig`
* 编译器: `gcc-arm-none-eabi`
* 调试器:`pyocd` openocd不支持HDSC器件
* 包管理工具 `pkgs`

View File

@ -2,8 +2,8 @@
* @Description:
* @Date: 2022-01-10 17:05:41
* @LastEditors: CK.Zh
* @LastEditTime: 2022-01-10 17:27:06
* @FilePath: /motion_ec_rtt/applications/main.c
* @LastEditTime: 2022-01-11 16:59:05
* @FilePath: /motion_ec/applications/main.c
*/
/*
* Copyright (C) 2021, Huada Semiconductor Co., Ltd.
@ -24,6 +24,11 @@
#include <rtthread.h>
#include <rtdevice.h>
#define LOG_TAG "MAIN"
#define LOG_LVL LOG_LVL_DBG
#include <ulog.h>
/*******************************************************************************
* Local type definitions ('typedef')
******************************************************************************/
@ -54,6 +59,7 @@
void key_handler(void *param)
{
flag = ~flag;
}
/**
@ -67,24 +73,35 @@ void key_handler(void *param)
******************************************************************************/
int32_t main(void)
{
rt_pin_mode(LED_PIN, PIN_MODE_OUTPUT);
rt_pin_attach_irq(KEY_PIN, PIN_IRQ_MODE_FALLING, key_handler, RT_NULL);
rt_pin_irq_enable(KEY_PIN, PIN_IRQ_ENABLE);
LOG_I("Go to main function");
rt_pin_mode(BUZZ_CTL_PIN, PIN_MODE_OUTPUT);
rt_pin_mode(PWR_LED_PIN, PIN_MODE_OUTPUT);
rt_pin_mode(PWR_BTN, PIN_MODE_INPUT);
rt_pin_mode(FUN_BTN, PIN_MODE_INPUT);
rt_pin_attach_irq(PWR_BTN, PIN_IRQ_MODE_FALLING, key_handler, RT_NULL);
rt_pin_irq_enable(PWR_BTN, PIN_IRQ_ENABLE);
rt_pin_attach_irq(FUN_BTN, PIN_IRQ_MODE_FALLING, key_handler, RT_NULL);
rt_pin_irq_enable(FUN_BTN, PIN_IRQ_ENABLE);
while(1)
{
if (flag == 0)
{
rt_pin_write(LED_PIN, PIN_HIGH);
rt_pin_write(PWR_LED_PIN, PIN_HIGH);
rt_thread_delay(500);
rt_pin_write(LED_PIN, PIN_LOW);
rt_pin_write(PWR_LED_PIN, PIN_LOW);
rt_thread_delay(500);
}
else
{
rt_pin_write(LED_PIN, PIN_HIGH);
rt_pin_write(PWR_LED_PIN, PIN_HIGH);
rt_thread_delay(2000);
rt_pin_write(LED_PIN, PIN_LOW);
rt_pin_write(PWR_LED_PIN, PIN_LOW);
rt_thread_delay(2000);
}
}

View File

@ -48,7 +48,7 @@ menu "On-chip Peripheral Drivers"
endif
menuconfig BSP_USING_I2C1
bool "Enable I2C1 BUS (software simulation)"
bool "Enable I2C1 BUS "
default n
select RT_USING_I2C
select RT_USING_I2C_BITOPS

View File

@ -2,8 +2,8 @@
* @Description:
* @Date: 2022-01-06 14:31:32
* @LastEditors: CK.Zh
* @LastEditTime: 2022-01-10 17:27:17
* @FilePath: /motion_ec_rtt/board/board.h
* @LastEditTime: 2022-01-11 18:12:23
* @FilePath: /motion_ec/board/board.h
*/
/*
* Copyright (C) 2021, Huada Semiconductor Co., Ltd.
@ -46,18 +46,53 @@ extern int __bss_end;
#define HEAP_END SRAM_END
#endif
//MISC
#define EC_PWR_BTN GET_PIN(B, 11)
#define EC_PWR_LED_PIN GET_PIN(B, 10)
#define EC_FUN_BTN GET_PIN(B, 2)
#define EC_BUZZ_CTL_PIN GET_PIN(B, 1)
#define LED_PIN GET_PIN(C, 13)
#define KEY_PIN GET_PIN(B, 9)
#define KEY_PIN GET_PIN(B, 9)
#define KEY_PIN GET_PIN(B, 9)
#define KEY_PIN GET_PIN(B, 9)
#define KEY_PIN GET_PIN(B, 9)
#define KEY_PIN GET_PIN(B, 9)
#define KEY_PIN GET_PIN(B, 9)
#define KEY_PIN GET_PIN(B, 9)
#define KEY_PIN GET_PIN(B, 9)
//CAN
#define EC_CAN_TX GET_PIN(B, 9)
#define EC_CAN_RX GET_PIN(B, 8)
#define EC_CAN_STBY GET_PIN(B, 7)
//Fan
#define EC_FAN_SNS GET_PIN(C, 6)
#define EC_FAN_CTL GET_PIN(B, 15)
//I2C0
#define EC_I2C0_SDA GET_PIN(A, 10)
#define EC_I2C0_SCL GET_PIN(A, 9)
//I21
#define EC_I2C1_SDA GET_PIN(B, 14)
#define EC_I2C1_SCL GET_PIN(B, 13)
//ADC
#define EC_ADC_5V0_B GET_PIN(A, 4)
#define EC_ADC_5V0_A GET_PIN(A, 5)
#define EC_ADC_12V0 GET_PIN(A, 6)
#define EC_ADC_BKP_BAT GET_PIN(A, 5)
#define EC_ADC_MAIN_PWR GET_PIN(C, 4)
#define EC_ADC_MON_EN GET_PIN(C, 5)
//PMB Interface
#define PMB_PS_ON GET_PIN(C, 0)
#define PMB_TEMP_SEN_EN GET_PIN(C, 1)
#define PMB_TEMP_SEN_ALT GET_PIN(C, 2)
#define PMB_CHRG_STAT2 GET_PIN(C, 3)
#define PMB_CHRG_STAT1 GET_PIN(A, 0)
#define PMB_CHRG_SHDN GET_PIN(A, 1)
#define PMB_COULOMB_ALCC GET_PIN(A, 2)
//SOM Management Interface
#define SOM_MGT_SYS_RESET GET_PIN(B, 6)
#define SOM_MGT_FORCE_REC GET_PIN(B, 5)
#define SOM_MGT_MOD_SLEEP GET_PIN(B, 4)
#define SOM_MGT_SHDN_REQ GET_PIN(B, 3)
#define SOM_MGT_POWER_EN GET_PIN(D, 2)
#define SOM_MGT_SLEEP_WAKE GET_PIN(C, 12)

View File

@ -2,8 +2,8 @@
* @Description:
* @Date: 2022-01-06 14:31:32
* @LastEditors: CK.Zh
* @LastEditTime: 2022-01-07 11:56:17
* @FilePath: /rt-thread/bsp/hc32l073/drivers/drv_gpio.c
* @LastEditTime: 2022-01-11 18:23:24
* @FilePath: /motion_ec/drivers/drv_gpio.c
*/
/*
* Copyright (C) 2021, Huada Semiconductor Co., Ltd.

View File

@ -1,3 +1,10 @@
/*
* @Description:
* @Date: 2022-01-10 17:05:41
* @LastEditors: CK.Zh
* @LastEditTime: 2022-01-11 16:43:29
* @FilePath: /motion_ec/rt-thread/components/drivers/misc/pin.c
*/
/*
* Copyright (c) 2006-2021, RT-Thread Development Team
*

View File

@ -11,7 +11,6 @@
#define RT_THREAD_PRIORITY_32
#define RT_THREAD_PRIORITY_MAX 32
#define RT_TICK_PER_SECOND 1000
#define RT_USING_OVERFLOW_CHECK
#define RT_USING_HOOK
#define RT_USING_IDLE_HOOK
#define RT_IDLE_HOOK_LIST_SIZE 4
@ -63,7 +62,7 @@
#define FINSH_USING_MSH
#define FINSH_THREAD_NAME "tshell"
#define FINSH_THREAD_PRIORITY 20
#define FINSH_THREAD_STACK_SIZE 512
#define FINSH_THREAD_STACK_SIZE 1024
#define FINSH_USING_HISTORY
#define FINSH_HISTORY_LINES 5
#define FINSH_USING_SYMTAB
@ -124,6 +123,7 @@
#define ULOG_OUTPUT_TIME
#define ULOG_OUTPUT_LEVEL
#define ULOG_OUTPUT_TAG
#define ULOG_OUTPUT_THREAD_NAME
#define ULOG_BACKEND_USING_CONSOLE
/* RT-Thread online packages */
@ -161,30 +161,6 @@
/* tools packages */
#define PKG_USING_EASYFLASH
#define PKG_EASYFLASH_ENV
#define PKG_EASYFLASH_ERASE_GRAN 4096
#define PKG_EASYFLASH_WRITE_GRAN_1BIT
#define PKG_EASYFLASH_WRITE_GRAN 1
#define PKG_EASYFLASH_START_ADDR 0
#define PKG_EASYFLASH_DEBUG
#define PKG_USING_EASYFLASH_V410
#define PKG_EASYFLASH_VER_NUM 0x40100
#define PKG_USING_EASYLOGGER
/* EasyLogger Options */
#define PKG_EASYLOGGER_ENABLE_OUTPUT
#define PKG_EASYLOGGER_OUTPUT_LVL_VERBOSE
#define PKG_EASYLOGGER_ENABLE_ASSERT
#define PKG_EASYLOGGER_LINE_BUF_SIZE 256
#define PKG_EASYLOGGER_FILTER_TAG_MAX_LEN 30
#define PKG_EASYLOGGER_FILTER_KW_MAX_LEN 16
#define PKG_EASYLOGGER_NEWLINE_SIGN_CRLF
#define PKG_EASYLOGGER_ENABLE_COLOR
#define PKG_USING_EASYLOGGER_V200
#define PKG_USING_ULOG_EASYFLASH
#define PKG_USING_ULOG_EASYFLASH_V00200
/* system packages */

View File

@ -2,8 +2,8 @@
Description:
Date: 2022-01-06 14:31:32
LastEditors: CK.Zh
LastEditTime: 2022-01-10 11:47:46
FilePath: /rt-thread/bsp/hc32l073/rtconfig.py
LastEditTime: 2022-01-11 12:02:35
FilePath: /motion_ec/rtconfig.py
'''
import os
@ -79,7 +79,7 @@ elif PLATFORM == 'armcc':
LFLAGS = DEVICE + ' --info sizes --info totals --info unused --info veneers --list rtthread.map --scatter "board/linker_scripts/link.sct"'
CFLAGS += ' -I' + EXEC_PATH + '/ARM/RV31/INC'
LFLAGS += ' --libpath ' + EXEC_PATH + '/ARM/RV31/LIB'
# LFLAGS += ' --libpath ' + EXEC_PATH + '/ARM/RV31/LIB'
EXEC_PATH += '/arm/bin40/'
@ -137,3 +137,5 @@ elif PLATFORM == 'iar':
EXEC_PATH = EXEC_PATH + '/arm/bin/'
POST_ACTION = ''