Compare commits
10 Commits
80cc752148
...
master
Author | SHA1 | Date | |
---|---|---|---|
0d1688b3ec | |||
aaba0e5991 | |||
9588134f2c | |||
e9bdad91a5 | |||
73ea1d6f5f | |||
fc6412adf0 | |||
2b2135eb98 | |||
8c977c62bd | |||
71bca532c5 | |||
4315af5d2c |
@@ -41,8 +41,8 @@ do
|
||||
|
||||
export layout_index=4 #4m flash with psram
|
||||
|
||||
. env_tmp.sh && [ "$NOT_CLEAN" == "" ] && make APP=$APP_SEL -C .. clobber
|
||||
make APP=$APP_SEL FLASH_SIZE=$FLASH -C ..
|
||||
. env_tmp.sh && [ "$NOT_CLEAN" == "" ] && make -j APP=$APP_SEL -C .. clobber
|
||||
make -j APP=$APP_SEL FLASH_SIZE=$FLASH -C ..
|
||||
|
||||
rm env_tmp.sh
|
||||
cd ../tools/gen_img
|
||||
|
@@ -93,7 +93,7 @@ elif [ $BUILD_FLAGS == 1 ]; then
|
||||
ENV_STRING=${CHIP_ID_ENV}${CHIP}
|
||||
echo $ENV_STRING >> env_tmp.sh
|
||||
cat env_tmp.sh
|
||||
. env_tmp.sh && make APP=$APP_SEL -C .. clobber && make APP=$APP_SEL FLASH_SIZE=4 -C ..
|
||||
. env_tmp.sh && make -j APP=$APP_SEL -C .. clobber && make -j APP=$APP_SEL FLASH_SIZE=4 -C ..
|
||||
rm env_tmp.sh
|
||||
for STR in ${CUSTOM_STRING[@]}; do
|
||||
cd ../tools/gen_img
|
||||
@@ -108,7 +108,7 @@ elif [ $BUILD_FLAGS == 2 ]; then
|
||||
ENV_STRING=${CHIP_ID_ENV}${CHIP}
|
||||
echo $ENV_STRING >> env_tmp.sh
|
||||
cat env_tmp.sh
|
||||
. env_tmp.sh && make APP=$APP_SEL -C .. clobber && make APP=$APP_SEL FLASH_SIZE=4 -C ..
|
||||
. env_tmp.sh && make -j APP=$APP_SEL -C .. clobber && make -j APP=$APP_SEL FLASH_SIZE=4 -C ..
|
||||
rm env_tmp.sh
|
||||
for STR in ${CUSTOM_STRING[@]}; do
|
||||
cd ../tools/gen_img
|
||||
@@ -146,7 +146,7 @@ elif [ $BUILD_FLAGS == 3 ]; then
|
||||
ENV_STRING=${CHIP_ID_ENV}${CHIP}
|
||||
echo $ENV_STRING >> env_tmp.sh
|
||||
cat env_tmp.sh
|
||||
. env_tmp.sh && make APP=$APP_SEL -C .. clobber && make APP=$APP_SEL FLASH_SIZE=4 -C ..
|
||||
. env_tmp.sh && make -j APP=$APP_SEL -C .. clobber && make -j APP=$APP_SEL FLASH_SIZE=4 -C ..
|
||||
rm env_tmp.sh
|
||||
cd ../tools/gen_img
|
||||
./gen_img.sh -d ${CHIP} -c ${STR} -i ${IMG_TYPE} -r flash -m lzma -s ${FLASH_SIZE} -b 2 -p ${PSRAM_SIZE}
|
||||
@@ -158,7 +158,7 @@ elif [ $BUILD_FLAGS == 4 ]; then
|
||||
ENV_STRING=${CHIP_ID_ENV}${CHIP}
|
||||
echo $ENV_STRING >> env_tmp.sh
|
||||
cat env_tmp.sh
|
||||
. env_tmp.sh && make APP=$APP_SEL -C .. clobber && make APP=$APP_SEL FLASH_SIZE=4 -C ..
|
||||
. env_tmp.sh && make -j APP=$APP_SEL -C .. clobber && make -j APP=$APP_SEL FLASH_SIZE=4 -C ..
|
||||
rm env_tmp.sh
|
||||
cd ../tools/gen_img
|
||||
./gen_img.sh -d ${CHIP} -c ${CUSTOM} -i ${IMG_TYPE} -r ${TYPE} -m lzma -s ${FLASH_SIZE} -b 2 -p ${PSRAM_SIZE}
|
||||
@@ -168,7 +168,7 @@ elif [ $BUILD_FLAGS == 5 ]; then
|
||||
echo "BUILD FLAGS: "${BUILD_FLAGS}
|
||||
echo $FLASH_SIZE_ENV >> env_tmp.sh
|
||||
cat env_tmp.sh
|
||||
. env_tmp.sh && make APP=$APP_SEL -C .. clobber && make APP=$APP_SEL FLASH_SIZE=4 -C ..
|
||||
. env_tmp.sh && make -j APP=$APP_SEL -C .. clobber && make -j APP=$APP_SEL FLASH_SIZE=4 -C ..
|
||||
rm env_tmp.sh
|
||||
|
||||
for STR in ${CUSTOM_STRING[@]}; do
|
||||
|
@@ -91,8 +91,8 @@ elif [ $BUILD_FLAGS == 1 ]; then
|
||||
cp $SRC_ENV_FILE env_tmp.sh
|
||||
echo $ENV_STRING >> env_tmp.sh
|
||||
cat env_tmp.sh
|
||||
. env_tmp.sh && [ "$NOT_CLEAN" == "" ] && make APP=$APP_SEL -C .. clobber
|
||||
make PLATFORM=CHIP APP=$APP_SEL FLASH_SIZE=4 -C ..
|
||||
. env_tmp.sh && [ "$NOT_CLEAN" == "" ] && make -j APP=$APP_SEL -C .. clobber
|
||||
make -j PLATFORM=CHIP APP=$APP_SEL FLASH_SIZE=4 -C ..
|
||||
rm env_tmp.sh
|
||||
for STR in ${CUSTOM_STRING[@]}; do
|
||||
cd ../tools/gen_img
|
||||
@@ -110,8 +110,8 @@ elif [ $BUILD_FLAGS == 2 ]; then
|
||||
cp $SRC_ENV_FILE env_tmp.sh
|
||||
echo $ENV_STRING >> env_tmp.sh
|
||||
cat env_tmp.sh
|
||||
. env_tmp.sh && [ "$NOT_CLEAN" == "" ] && make APP=$APP_SEL -C .. clobber
|
||||
make APP=$APP_SEL FLASH_SIZE=4 -C ..
|
||||
. env_tmp.sh && [ "$NOT_CLEAN" == "" ] && make -j APP=$APP_SEL -C .. clobber
|
||||
make -j APP=$APP_SEL FLASH_SIZE=4 -C ..
|
||||
rm env_tmp.sh
|
||||
for STR in ${CUSTOM_STRING[@]}; do
|
||||
cd ../tools/gen_img
|
||||
@@ -155,8 +155,8 @@ elif [ $BUILD_FLAGS == 3 ]; then
|
||||
ENV_STRING=${CHIP_ID_ENV}${CHIP}
|
||||
echo $ENV_STRING >> env_tmp.sh
|
||||
cat env_tmp.sh
|
||||
. env_tmp.sh && [ "$NOT_CLEAN" == "" ] && make APP=$APP_SEL -C .. clobber
|
||||
make APP=$APP_SEL FLASH_SIZE=4 -C ..
|
||||
. env_tmp.sh && [ "$NOT_CLEAN" == "" ] && make -j APP=$APP_SEL -C .. clobber
|
||||
make -j APP=$APP_SEL FLASH_SIZE=4 -C ..
|
||||
rm env_tmp.sh
|
||||
cd ../tools/gen_img
|
||||
if [ "$STR" != "jsmt" ]; then
|
||||
@@ -171,8 +171,8 @@ elif [ $BUILD_FLAGS == 4 ]; then
|
||||
cp $SRC_ENV_FILE env_tmp.sh
|
||||
echo $ENV_STRING >> env_tmp.sh
|
||||
cat env_tmp.sh
|
||||
. env_tmp.sh && [ "$NOT_CLEAN" == "" ] && make APP=$APP_SEL -C .. clobber
|
||||
make APP=$APP_SEL FLASH_SIZE=4 -C ..
|
||||
. env_tmp.sh && [ "$NOT_CLEAN" == "" ] && make -j APP=$APP_SEL -C .. clobber
|
||||
make -j APP=$APP_SEL FLASH_SIZE=4 -C ..
|
||||
rm env_tmp.sh
|
||||
cd ../tools/gen_img
|
||||
if [ "$STR" != "jsmt" ]; then
|
||||
@@ -185,8 +185,8 @@ elif [ $BUILD_FLAGS == 5 ]; then
|
||||
cp $SRC_ENV_FILE env_tmp.sh
|
||||
echo $FLASH_SIZE_ENV >> env_tmp.sh
|
||||
cat env_tmp.sh
|
||||
. env_tmp.sh && [ "$NOT_CLEAN" == "" ] && make APP=$APP_SEL -C .. clobber
|
||||
make APP=$APP_SEL FLASH_SIZE=4 -C ..
|
||||
. env_tmp.sh && [ "$NOT_CLEAN" == "" ] && make -j APP=$APP_SEL -C .. clobber
|
||||
make -j APP=$APP_SEL FLASH_SIZE=4 -C ..
|
||||
rm env_tmp.sh
|
||||
|
||||
for STR in ${CUSTOM_STRING[@]}; do
|
||||
|
@@ -13,12 +13,12 @@ if __name__ == "__main__":
|
||||
cmd=f"{' '.join(sys.argv[1:])} > build_log.log"
|
||||
if not ('not_clean' in sys.argv[1:]):
|
||||
os.system("python3 ../clear_output.py > /dev/null")
|
||||
try:
|
||||
os.remove("../make_flags.txt")
|
||||
os.remove("../python_script_log.log")
|
||||
except Exception as e:
|
||||
print(e)
|
||||
# os.system("python3 ../praper_vscode.py clear >> ../python_script_log.log")
|
||||
try:
|
||||
os.remove("../make_flags.txt")
|
||||
os.remove("../python_script_log.log")
|
||||
except Exception as e:
|
||||
print(e)
|
||||
os.system("python3 ../praper_vscode.py clear >> ../python_script_log.log")
|
||||
path="../tools/gen_img/customer"
|
||||
if os.path.exists(path):
|
||||
shutil.rmtree(path)
|
||||
|
@@ -235,6 +235,7 @@ AR = arm-none-eabi-ar
|
||||
SIZE = arm-none-eabi-size
|
||||
OBJCOPY = arm-none-eabi-objcopy
|
||||
STRIP = arm-none-eabi-strip
|
||||
OBJDUMP = arm-none-eabi-objdump
|
||||
MAKEDEP = -MM
|
||||
|
||||
FLAGS = -mcpu=cortex-m3 -mthumb -Wall -Werror -g $(OPT_FLAG) \
|
||||
@@ -255,6 +256,7 @@ SIZE = arm-none-eabi-size
|
||||
STRIP = arm-none-eabi-strip
|
||||
MAKEDEP = -M -c
|
||||
OBJCOPY = arm-none-eabi-objcopy
|
||||
OBJDUMP = arm-none-eabi-objdump
|
||||
|
||||
FLAGS = \
|
||||
--cpu=Cortex-M3 --thumb --fpmode=std --fpu=vfpv4_d16 -g $(OPT_FLAG)\
|
||||
@@ -280,6 +282,7 @@ AR = riscv32-unknown-elf-ar
|
||||
SIZE = riscv32-unknown-elf-size
|
||||
OBJCOPY = riscv32-unknown-elf-objcopy
|
||||
STRIP = riscv32-unknown-elf-strip
|
||||
OBJDUMP = riscv32-unknown-elf-objdump
|
||||
MAKEDEP = -MM
|
||||
FLAGS = -march=$(ISA) -mabi=ilp32 -ffunction-sections -fdata-sections -ffast-math -fno-common -fno-builtin-printf -Wall -Werror $(GDB_FLAG) $(OPT_FLAG)\
|
||||
$(addprefix -D, $(PRE_MARCO))\
|
||||
@@ -298,6 +301,7 @@ AR = riscv64-unknown-elf-ar
|
||||
SIZE = riscv64-unknown-elf-size
|
||||
OBJCOPY = riscv64-unknown-elf-objcopy
|
||||
STRIP = riscv64-unknown-elf-strip
|
||||
OBJDUMP = riscv64-unknown-elf-objdump
|
||||
MAKEDEP = -MM
|
||||
FLAGS = -march=$(ISA) -mabi=$(ABI) -ffunction-sections -fdata-sections -ffast-math -fno-common -Wno-array-bounds -fno-builtin-printf -Wall $(GDB_FLAG) $(OPT_FLAG)\
|
||||
$(addprefix -D, $(PRE_MARCO))\
|
||||
@@ -347,6 +351,8 @@ $(OUTPUT_FULL_NAME): $(OUTPUT_DIR) $(BIN_DIR)/.sub_dirs $(BIN_DIR)/.ext_src $(OB
|
||||
$(SIZE) $(OUTPUT_FULL_NAME) ;\
|
||||
$(OBJCOPY) -O binary $(OUTPUT_FULL_NAME) $(OUTPUT_DIR)/$(OUTPUT_NAME).bin ;\
|
||||
$(BIN2HEX) $(OUTPUT_DIR)/$(OUTPUT_NAME).bin $(OUTPUT_DIR)/$(OUTPUT_NAME).hex;\
|
||||
$(CC) -v > $(OUTPUT_DIR)/$(OUTPUT_NAME).asm 2>&1;\
|
||||
$(OBJDUMP) -d $(OUTPUT_FULL_NAME) >> $(OUTPUT_DIR)/$(OUTPUT_NAME).asm;\
|
||||
elif [ 2 -eq $(OUTPUT_TYPE) ];then\
|
||||
$(AR) -rc $(OUTPUT_FULL_NAME) $(OBJECTS) || exit 1;\
|
||||
elif [ 3 -eq $(OUTPUT_TYPE) ];then\
|
||||
|
@@ -51,9 +51,12 @@ void *os_mem_malloc(module_id_t module_id, size_t size)
|
||||
#endif
|
||||
{
|
||||
(void)module_id; // avoid warning. to be fixed.
|
||||
void *buf = pvPortMalloc(size);
|
||||
#if IOT_OS_MALLOC_DEBUG
|
||||
iot_printf("%s:%d malloc.\n", file, line);
|
||||
iot_printf("os_mem_malloc: size=%d\n", size);
|
||||
#endif
|
||||
void* buf = pvPortMalloc(size);
|
||||
#if IOT_OS_MALLOC_DEBUG
|
||||
iot_printf("%s:%d malloc. p=%p\n", file, line, buf);
|
||||
#endif
|
||||
if (buf) {
|
||||
os_mem_set(buf, 0, size);
|
||||
|
@@ -153,6 +153,9 @@ uint8_t gpio_pin_func_get(uint32_t gpio)
|
||||
return 0;
|
||||
}
|
||||
|
||||
// 配置gpio输入的时候如果有gpio的func选通了这个外设,则这个外设可以选择接收mtx的信号还是gpio的信号
|
||||
// 指定外设输入连接的通路,0通过矩阵连接,1直连到gpio,对于有func的那一路起作用
|
||||
// offset要操作的寄存器偏移地址 val值
|
||||
void IRAM_ATTR gpio_mtx_sig_in_set_core(uint32_t offset, uint32_t val)
|
||||
{
|
||||
uint32_t tmp;
|
||||
@@ -163,6 +166,7 @@ void IRAM_ATTR gpio_mtx_sig_in_set_core(uint32_t offset, uint32_t val)
|
||||
GPIO_MTX_WRITE_REG(offset, tmp);
|
||||
}
|
||||
|
||||
// mtx sig信号到外设的输入源,0通过mtx进来,1常为0,2常为1,3通过mtx反向
|
||||
void IRAM_ATTR gpio_mtx_sig_in_set_def(uint32_t offset, uint32_t val)
|
||||
{
|
||||
uint32_t tmp;
|
||||
@@ -171,6 +175,7 @@ void IRAM_ATTR gpio_mtx_sig_in_set_def(uint32_t offset, uint32_t val)
|
||||
GPIO_MTX_WRITE_REG(offset, tmp);
|
||||
}
|
||||
|
||||
// mtx 信号来自哪个gpio,val gpio序号
|
||||
void IRAM_ATTR gpio_mtx_sig_in_set_gpio(uint32_t offset, uint32_t val)
|
||||
{
|
||||
uint32_t tmp;
|
||||
@@ -180,6 +185,7 @@ void IRAM_ATTR gpio_mtx_sig_in_set_gpio(uint32_t offset, uint32_t val)
|
||||
GPIO_MTX_WRITE_REG(offset, tmp);
|
||||
}
|
||||
|
||||
// 找到指定信号连接的gpio序号
|
||||
uint8_t IRAM_ATTR gpio_mtx_sig_in_get_gpio(uint8_t sig_id)
|
||||
{
|
||||
uint32_t sig_addr;
|
||||
@@ -190,6 +196,8 @@ uint8_t IRAM_ATTR gpio_mtx_sig_in_get_gpio(uint8_t sig_id)
|
||||
return (uint8_t)REG_FIELD_GET(SIG_IN_GPIO_SEL, rd_gpio);
|
||||
}
|
||||
|
||||
// 指定gpio输出到哪个mtx sig上,为255时使用gpio软控
|
||||
// offset 寄存器偏移地址, val mtx sig信号id
|
||||
void IRAM_ATTR gpio_mtx_sig_out_set_sel(uint32_t offset, uint32_t val)
|
||||
{
|
||||
uint32_t tmp;
|
||||
@@ -198,6 +206,7 @@ void IRAM_ATTR gpio_mtx_sig_out_set_sel(uint32_t offset, uint32_t val)
|
||||
GPIO_MTX_WRITE_REG(offset, tmp);
|
||||
}
|
||||
|
||||
// 为mtx sig id绑定gpio,输入是sig绑定gpio,输出是gpio绑sig
|
||||
void IRAM_ATTR gpio_mtx_sig_in(uint8_t id, uint8_t gpio, uint32_t mode)
|
||||
{
|
||||
uint32_t offset;
|
||||
@@ -226,6 +235,8 @@ void IRAM_ATTR gpio_mtx_sig_in_default(uint8_t id)
|
||||
gpio_mtx_sig_in_set_def(offset, 2);
|
||||
}
|
||||
|
||||
// 外设要通过mtx输出信号到gpio,gpio的func必须设置为0,并且id不为255
|
||||
// 如果id为255,则连接到gpio控制
|
||||
void IRAM_ATTR gpio_mtx_sig_out(uint8_t id, uint8_t gpio)
|
||||
{
|
||||
uint32_t offset;
|
||||
@@ -257,7 +268,8 @@ void gpio_module_pin_select(gpio_sig_info_t *info)
|
||||
}
|
||||
}
|
||||
|
||||
void gpio_module_sig_select(gpio_sig_info_t *info, uint32_t mode)
|
||||
// 选择gpio到外设的信号通路,mode为0时通过func连接,mode为1时通过mtx连接
|
||||
void gpio_module_sig_select(gpio_sig_info_t* info, uint32_t mode)
|
||||
{
|
||||
int i = 0;
|
||||
uint8_t gpio = 0;
|
||||
|
@@ -24,6 +24,7 @@ extern unsigned int _heap_start;
|
||||
#define MEM_MAP_PART_0_ADDR ((int)&_heap_start)
|
||||
#define MEM_MAP_PART_0_LENTH ((size_t)((unsigned char *)&_heap_end - \
|
||||
(unsigned char*)&_heap_start))
|
||||
#define OS_DUMP_START ((int)&_heap_end)
|
||||
|
||||
#if (IOT_STA_CONTROL_MODE == IOT_STA_CONTROL_TYPE_STA)
|
||||
|
||||
@@ -31,8 +32,24 @@ extern unsigned int _heap_start;
|
||||
|
||||
#else /* (IOT_STA_CONTROL_MODE == IOT_STA_CONTROL_TYPE_STA) */
|
||||
|
||||
#if (IOT_MP_SUPPORT == 0)
|
||||
|
||||
#if RUN_IN_PSRAM
|
||||
|
||||
#define MEM_MAP_RESERVED_BUF_SZ (300 * 1024)
|
||||
|
||||
#else /* RUN_IN_PSRAM */
|
||||
|
||||
#define MEM_MAP_RESERVED_BUF_SZ (128 * 1024)
|
||||
|
||||
#endif /* RUN_IN_PSRAM */
|
||||
|
||||
#else /* IOT_MP_SUPPORT == 0 */
|
||||
|
||||
#define MEM_MAP_RESERVED_BUF_SZ (64 * 1024)
|
||||
|
||||
#endif /* IOT_MP_SUPPORT == 0 */
|
||||
|
||||
#endif /* (IOT_STA_CONTROL_MODE == IOT_STA_CONTROL_TYPE_STA) */
|
||||
|
||||
#if (RUN_IN_PSRAM)
|
||||
@@ -108,7 +125,6 @@ extern unsigned int _heap_start;
|
||||
MEM_MAP_PART_1_ADDR, MEM_MAP_PART_1_LENTH, \
|
||||
MEM_MAP_PART_2_ADDR, MEM_MAP_PART_2_LENTH, \
|
||||
MEM_MAP_PART_3_ADDR, MEM_MAP_PART_3_LENTH}
|
||||
|
||||
#else /* (BUILD_AMP_TYPE == IOT_BUILD_AMP_NONE) */
|
||||
|
||||
#define MEM_MAP_PART_1_ADDR (0x70000000)
|
||||
|
@@ -116,7 +116,7 @@ void ledc_timer_ctrl(LEDC_PORT port, uint8_t status);
|
||||
void ledc_cnt_ena(LEDC_PORT port, uint8_t status);
|
||||
|
||||
/**
|
||||
* @brief ledc_polarity_sel() - ledc输出极性选择
|
||||
* @brief ledc_polarity_sel() - ledc输出极性选择,
|
||||
* @param port: ledc 通道
|
||||
* @param polarity: OUT_POL_ORIGINAL 不反相
|
||||
* OUT_POL_INVERT 反相
|
||||
@@ -124,7 +124,8 @@ void ledc_cnt_ena(LEDC_PORT port, uint8_t status);
|
||||
void ledc_polarity_sel(LEDC_PORT port, uint8_t polarity);
|
||||
|
||||
/**
|
||||
* @brief ledc_idle_level_sel() - ledc空闲时电平状态选择
|
||||
* @brief ledc_idle_level_sel() - ledc空闲时电平状态选择,
|
||||
* 空闲是指关闭占空比的情况
|
||||
* @param port: ledc 通道
|
||||
* @param level: IDLE_LEVEL_HIGH 空闲时为高电平
|
||||
* IDLE_LEVEL_LOW 空闲时为低电平
|
||||
@@ -168,7 +169,7 @@ void ledc_l2h_point_set(LEDC_PORT port, uint16_t point);
|
||||
void ledc_duty_cnt_sel(LEDC_PORT port, uint8_t duty_cnt);
|
||||
|
||||
/**
|
||||
* @brief ledc_thrs_set() - 计数器阈值设置
|
||||
* @brief ledc_thrs_set() - 计数器阈值设置,计数器大于这个值之后会重新开始计数
|
||||
* @param port: ledc 通道
|
||||
* @param thrs: 阈值,范围0-0xffff
|
||||
*/
|
||||
@@ -211,35 +212,36 @@ void ledc_phase1_mode_sel(LEDC_PORT port, uint8_t mode);
|
||||
void ledc_phase2_mode_sel(LEDC_PORT port, uint8_t mode);
|
||||
|
||||
/**
|
||||
* @brief ledc_phase1_scale_set() - phase1的渐变幅度设置
|
||||
* @brief ledc_phase1_scale_set() - phase1的渐变幅度设置,scale为一次计数器周期中变化的count数
|
||||
* @param port: ledc 通道
|
||||
* @param scale: 范围 0-0xff
|
||||
*/
|
||||
void ledc_phase1_scale_set(LEDC_PORT port, uint8_t scale);
|
||||
|
||||
/**
|
||||
* @brief ledc_phase2_scale_set() - phase2的渐变幅度设置
|
||||
* @brief ledc_phase2_scale_set() - phase2的渐变幅度设置,scale为一次计数器周期中变化的count数
|
||||
* @param port: ledc 通道
|
||||
* @param scale: 范围 0-0xff
|
||||
*/
|
||||
void ledc_phase2_scale_set(LEDC_PORT port, uint8_t scale);
|
||||
|
||||
/**
|
||||
* @brief ledc_cycle_times_set() - 设置一个loop里有多少个cycle
|
||||
* @brief ledc_cycle_times_set() - 设置一个loop里有多少个cycle,
|
||||
* phase1 blink加上phase2 blink所使用的时间为一个cycle
|
||||
* @param port: ledc 通道
|
||||
* @param times: 范围 0-0xff
|
||||
*/
|
||||
void ledc_cycle_times_set(LEDC_PORT port, uint8_t times);
|
||||
|
||||
/**
|
||||
* @brief ledc_cycle_times_set() - 设置一共多少个loop
|
||||
* @brief ledc_loop_times_set() - 设置一共多少个loop
|
||||
* @param port: ledc 通道
|
||||
* @param times: 范围 0-0xff
|
||||
*/
|
||||
void ledc_loop_times_set(LEDC_PORT port, uint8_t times);
|
||||
|
||||
/**
|
||||
* @brief ledc_nop_num_set() - 设置一共多少个loop
|
||||
* @brief ledc_nop_num_set() - 设置一个loop里有多少个nop计数器周期,这个时候处于空闲状态
|
||||
* @param port: ledc 通道
|
||||
* @param times: 范围 0-0xff
|
||||
*/
|
||||
@@ -253,7 +255,7 @@ void ledc_nop_num_set(LEDC_PORT port, uint16_t num);
|
||||
void ledc_common_cnt_ena(uint8_t en);
|
||||
|
||||
/**
|
||||
* @brief ledc_common_thrs_set() - 共用计数器阈值设置
|
||||
* @brief ledc_common_thrs_set() - 共用计数器阈值设置,计数器大于这个值之后会重新开始计数
|
||||
* @param thrs: 阈值,范围0-0xffff
|
||||
*/
|
||||
void ledc_common_thrs_set(uint16_t thrs);
|
||||
|
@@ -137,6 +137,7 @@ void ledc_gpio_config(LEDC_PORT port, uint8_t gpio)
|
||||
gpio_module_sig_select(&info, GPIO_MTX_MODE_MATRIX);
|
||||
}
|
||||
|
||||
// 定时器复位
|
||||
void ledc_timer_rst(LEDC_PORT port)
|
||||
{
|
||||
uint32_t tmp;
|
||||
@@ -152,6 +153,7 @@ void ledc_timer_rst(LEDC_PORT port)
|
||||
timer_hw_write_reg(port, CFG_LEDC_TIMER0_CONF_ADDR, tmp);
|
||||
}
|
||||
|
||||
// 定时器初始化 div是分频,实际分频为div+1
|
||||
void ledc_timer_init(LEDC_PORT port, uint16_t div)
|
||||
{
|
||||
uint32_t tmp;
|
||||
@@ -165,6 +167,7 @@ void ledc_timer_init(LEDC_PORT port, uint16_t div)
|
||||
timer_hw_write_reg(port, CFG_LEDC_TIMER0_CONF_ADDR, tmp);
|
||||
}
|
||||
|
||||
// 定时器启动或暂停 1启动 0暂停
|
||||
void ledc_timer_ctrl(LEDC_PORT port, uint8_t status)
|
||||
{
|
||||
uint32_t tmp;
|
||||
@@ -185,6 +188,7 @@ void ledc_timer_ctrl(LEDC_PORT port, uint8_t status)
|
||||
timer_hw_write_reg(port, CFG_LEDC_TIMER0_CONF_ADDR, tmp);
|
||||
}
|
||||
|
||||
// 输出极性 1反向 0不反向
|
||||
void ledc_polarity_sel(LEDC_PORT port, uint8_t polarity)
|
||||
{
|
||||
uint32_t tmp;
|
||||
@@ -198,6 +202,7 @@ void ledc_polarity_sel(LEDC_PORT port, uint8_t polarity)
|
||||
ledc_hw_write_reg(port, CFG_LEDC0_CONF_ADDR, tmp);
|
||||
}
|
||||
|
||||
// 空闲时状态 1空闲时高 0 空闲时低
|
||||
void ledc_idle_level_sel(LEDC_PORT port, uint8_t level)
|
||||
{
|
||||
uint32_t tmp;
|
||||
@@ -211,6 +216,7 @@ void ledc_idle_level_sel(LEDC_PORT port, uint8_t level)
|
||||
ledc_hw_write_reg(port, CFG_LEDC0_CONF_ADDR, tmp);
|
||||
}
|
||||
|
||||
// 相位1闪烁次数
|
||||
void ledc_phase1_blink_times_set(LEDC_PORT port, uint16_t times)
|
||||
{
|
||||
uint32_t tmp;
|
||||
@@ -225,6 +231,7 @@ void ledc_phase1_blink_times_set(LEDC_PORT port, uint16_t times)
|
||||
|
||||
}
|
||||
|
||||
// 相位2闪烁次数
|
||||
void ledc_phase2_blink_times_set(LEDC_PORT port, uint16_t times)
|
||||
{
|
||||
uint32_t tmp;
|
||||
@@ -239,6 +246,7 @@ void ledc_phase2_blink_times_set(LEDC_PORT port, uint16_t times)
|
||||
|
||||
}
|
||||
|
||||
// 控制脉冲输出由高到低的时钟刻度
|
||||
void ledc_h2l_point_set(LEDC_PORT port, uint16_t point)
|
||||
{
|
||||
uint32_t tmp;
|
||||
@@ -252,6 +260,7 @@ void ledc_h2l_point_set(LEDC_PORT port, uint16_t point)
|
||||
ledc_hw_write_reg(port, CFG_LEDC0_DUTY_CONF0_ADDR, tmp);
|
||||
}
|
||||
|
||||
// 控制脉冲由低到高的时钟刻度
|
||||
void ledc_l2h_point_set(LEDC_PORT port, uint16_t point)
|
||||
{
|
||||
uint32_t tmp;
|
||||
@@ -265,6 +274,7 @@ void ledc_l2h_point_set(LEDC_PORT port, uint16_t point)
|
||||
ledc_hw_write_reg(port, CFG_LEDC0_DUTY_CONF0_ADDR, tmp);
|
||||
}
|
||||
|
||||
// 选择计数器 0使用自身参考时钟 1使用通用时钟
|
||||
void ledc_duty_cnt_sel(LEDC_PORT port, uint8_t duty_cnt)
|
||||
{
|
||||
uint32_t tmp;
|
||||
@@ -278,6 +288,7 @@ void ledc_duty_cnt_sel(LEDC_PORT port, uint8_t duty_cnt)
|
||||
ledc_hw_write_reg(port, CFG_LEDC0_DUTY_CONF1_ADDR, tmp);
|
||||
}
|
||||
|
||||
// 打开占空比计数
|
||||
void ledc_cnt_ena(LEDC_PORT port, uint8_t en)
|
||||
{
|
||||
uint32_t tmp;
|
||||
@@ -291,6 +302,7 @@ void ledc_cnt_ena(LEDC_PORT port, uint8_t en)
|
||||
ledc_hw_write_reg(port, CFG_LEDC0_DUTY_CONF1_ADDR, tmp);
|
||||
}
|
||||
|
||||
// 设置占空比阈值
|
||||
void ledc_thrs_set(LEDC_PORT port, uint16_t thrs)
|
||||
{
|
||||
uint32_t tmp;
|
||||
@@ -304,6 +316,7 @@ void ledc_thrs_set(LEDC_PORT port, uint16_t thrs)
|
||||
ledc_hw_write_reg(port, CFG_LEDC0_DUTY_CONF1_ADDR, tmp);
|
||||
}
|
||||
|
||||
// 相位模式选择 0普通模式 1相位模式
|
||||
void ledc_phase_opt_sel(LEDC_PORT port, uint8_t opt)
|
||||
{
|
||||
uint32_t tmp;
|
||||
@@ -317,6 +330,7 @@ void ledc_phase_opt_sel(LEDC_PORT port, uint8_t opt)
|
||||
ledc_hw_write_reg(port, CFG_LEDC0_DUTY_CONF5_ADDR, tmp);
|
||||
}
|
||||
|
||||
// 相位数量 0单相位 1双相位
|
||||
void ledc_phase_num_sel(LEDC_PORT port, uint8_t num)
|
||||
{
|
||||
uint32_t tmp;
|
||||
@@ -330,6 +344,7 @@ void ledc_phase_num_sel(LEDC_PORT port, uint8_t num)
|
||||
ledc_hw_write_reg(port, CFG_LEDC0_DUTY_CONF5_ADDR, tmp);
|
||||
}
|
||||
|
||||
// 相位1的相位模式 0占空比模式 1保持关闭 2递增模式 3递减模式
|
||||
void ledc_phase1_mode_sel(LEDC_PORT port, uint8_t mode)
|
||||
{
|
||||
uint32_t tmp;
|
||||
@@ -344,6 +359,7 @@ void ledc_phase1_mode_sel(LEDC_PORT port, uint8_t mode)
|
||||
ledc_hw_write_reg(port, CFG_LEDC0_DUTY_CONF5_ADDR, tmp);
|
||||
}
|
||||
|
||||
// 相位2的相位模式 0占空比模式 1保持关闭 2递增模式 3递减模式
|
||||
void ledc_phase2_mode_sel(LEDC_PORT port, uint8_t mode)
|
||||
{
|
||||
uint32_t tmp;
|
||||
@@ -359,6 +375,7 @@ void ledc_phase2_mode_sel(LEDC_PORT port, uint8_t mode)
|
||||
ledc_hw_write_reg(port, CFG_LEDC0_DUTY_CONF5_ADDR, tmp);
|
||||
}
|
||||
|
||||
// 相位1阴影模式下的信号周期变化程度
|
||||
void ledc_phase1_scale_set(LEDC_PORT port, uint8_t scale)
|
||||
{
|
||||
uint32_t tmp;
|
||||
@@ -372,6 +389,7 @@ void ledc_phase1_scale_set(LEDC_PORT port, uint8_t scale)
|
||||
ledc_hw_write_reg(port, CFG_LEDC0_DUTY_CONF1_ADDR, tmp);
|
||||
}
|
||||
|
||||
// 相位2阴影模式下的信号周期变化幅度
|
||||
void ledc_phase2_scale_set(LEDC_PORT port, uint8_t scale)
|
||||
{
|
||||
uint32_t tmp;
|
||||
@@ -385,6 +403,7 @@ void ledc_phase2_scale_set(LEDC_PORT port, uint8_t scale)
|
||||
ledc_hw_write_reg(port, CFG_LEDC0_DUTY_CONF5_ADDR, tmp);
|
||||
}
|
||||
|
||||
// 无nop状态的循环数
|
||||
void ledc_cycle_times_set(LEDC_PORT port, uint8_t times)
|
||||
{
|
||||
uint32_t tmp;
|
||||
|
@@ -15,8 +15,11 @@ ADD_INCLUDE += $(TOPDIR)/plc/halphy/inc $(TOPDIR)/inc/compiler/gcc $(TOPDIR)/com
|
||||
PRE_MARCO += _MODULE_NAME_=\"COREMARK\"
|
||||
PRE_MARCO += _MODULE_VERSION_=\"V1.0.0\"
|
||||
|
||||
OPT_FLAG_ = -Os
|
||||
LD_SCRIPT = coremark_link_soc.lds
|
||||
OPT_FLAG = -O3
|
||||
OPT_FLAG = $(OPT_FLAG_) # -fno-default-inline
|
||||
PRE_MARCO += COMPILER_FLAGS=\"$(OPT_FLAG_)\"
|
||||
OUTPUT_NAME = kl3_core_mark$(OPT_FLAG_)
|
||||
|
||||
ifeq ($(gcc), arm)
|
||||
ADD_INCLUDE += $(TOPDIR)/os/freertos/src/portable/ARM_CM3
|
||||
|
@@ -27,6 +27,10 @@
|
||||
#include "iot_clock.h"
|
||||
#include "clk.h"
|
||||
|
||||
#include "string.h"
|
||||
#include "hw_reg_api.h"
|
||||
#include "ahb_rf.h"
|
||||
|
||||
extern void _start(void);
|
||||
extern void core_main(void);
|
||||
|
||||
@@ -39,25 +43,95 @@ void delay_us(uint32_t us)
|
||||
gp_timer_stop(0);
|
||||
}
|
||||
|
||||
void ahb_core0_branch_pred_enable(int enable)
|
||||
{
|
||||
uint32_t tmp;
|
||||
|
||||
tmp = AHB_REG_LITE0_READ_REG(CFG_AHB_CORE0_CFG0_ADDR);
|
||||
REG_FIELD_SET(CORE0_BTB_EB, tmp, enable);
|
||||
AHB_REG_LITE0_WRITE_REG(CFG_AHB_CORE0_CFG0_ADDR, tmp);
|
||||
}
|
||||
|
||||
|
||||
static char g_buff[4096*2] = { 0 };
|
||||
static char g_buff2[4096*2] = { 0 };
|
||||
|
||||
|
||||
|
||||
void memcpy_test(int times) {
|
||||
uint32_t tick1,tick2;
|
||||
register int var = times;
|
||||
tick1 = gp_timer_get_current_val(0);
|
||||
for (int i = 0;i < var;i++) {
|
||||
memcpy(g_buff, g_buff2, 4096);
|
||||
}
|
||||
tick2 = gp_timer_get_current_val(0);
|
||||
iot_printf("memcpy %d times cost %d us\n", times, tick2 - tick1);
|
||||
}
|
||||
|
||||
void memset_test(int times) {
|
||||
uint32_t tick1,tick2;
|
||||
register int var = times;
|
||||
tick1 = gp_timer_get_current_val(0);
|
||||
for (int i = 0;i < var;i++) {
|
||||
memset(g_buff, 0, 4096);
|
||||
}
|
||||
tick2 = gp_timer_get_current_val(0);
|
||||
iot_printf("memset %d times cost %d us\n", times, tick2 - tick1);
|
||||
}
|
||||
|
||||
|
||||
// 在cpu为150m时
|
||||
// 如果在memcpy之后不使用g_buff,则memcpy 100000次 耗时为 1954000 us
|
||||
// 如果在memcpy之后使用了g_buff,则memcpy 100000次 耗时为 2036668 us
|
||||
// O3优化比O0优化效率低 好像是因为内联了
|
||||
void mem_check() {
|
||||
if (memcmp(g_buff, g_buff2, 4) != 0) {
|
||||
iot_printf("memcopy failed\n");
|
||||
}
|
||||
// memset(g_buff, 0, 4096);
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
iot_interrupt_init(0);
|
||||
|
||||
dbg_uart_init();
|
||||
wdg_deinit(0);
|
||||
wdg_deinit(1);
|
||||
wdg_deinit(2);
|
||||
|
||||
clk_core_init();
|
||||
clk_core_freq_set(CLK_FRQ_150M);
|
||||
iot_printf("start\r\n" );
|
||||
ahb_core0_set_start((uint32_t) _start);
|
||||
gp_timer_init();
|
||||
iot_printf("Compiler flags : %s\n", COMPILER_FLAGS);
|
||||
iot_printf("cpu clk frq : %d\n", CLK_FRQ_150M);
|
||||
|
||||
// int t = 0;
|
||||
// while (1) {
|
||||
// iot_printf("%d\r\n", t++);
|
||||
// delay_us(1000000);
|
||||
// }
|
||||
gp_timer_set(0, 0xffffffff, 1);
|
||||
gp_timer_start(0);
|
||||
memset(g_buff2, 0xff, 4096);
|
||||
|
||||
ahb_core0_branch_pred_enable(1);
|
||||
iot_printf("branch prediction on\n");
|
||||
memcpy_test(100000);
|
||||
mem_check();
|
||||
|
||||
iot_printf("\n");
|
||||
|
||||
ahb_core0_branch_pred_enable(0);
|
||||
iot_printf("branch prediction off\n");
|
||||
memcpy_test(100000);
|
||||
mem_check();
|
||||
|
||||
ahb_core0_branch_pred_enable(1);
|
||||
iot_printf("branch prediction on\n");
|
||||
core_main();
|
||||
iot_printf("\n");
|
||||
|
||||
ahb_core0_branch_pred_enable(0);
|
||||
iot_printf("branch prediction off\n");
|
||||
core_main();
|
||||
while(1) {
|
||||
|
||||
|
@@ -52,7 +52,7 @@ ADD_LIB += os driver common rf_mac
|
||||
.PHONY: TARGET
|
||||
TARGET: .output/plc/lib/kl3_core1.out
|
||||
@echo "const char plc_core1[] = {" > plc_core1.h
|
||||
@./bin2hex_frame ../kl3_core1/.output/plc/lib/kl3_core1.bin tmp.txt
|
||||
@./bin2hex_frame ../kl3_core1/.output/plc/lib/kl3_core1.bin tmp.txt > /dev/null
|
||||
@cat tmp.txt >> plc_core1.h
|
||||
@echo "};" >> plc_core1.h
|
||||
@mv plc_core1.h ../kl3_core0
|
||||
|
63
dtest/dtest3/romlib_test/Makefile
Normal file
63
dtest/dtest3/romlib_test/Makefile
Normal file
@@ -0,0 +1,63 @@
|
||||
|
||||
# OUTPUT type
|
||||
# 1 - .out
|
||||
# 2 - .a
|
||||
# 3 - .so
|
||||
OUTPUT_TYPE = 1
|
||||
OUTPUT_NAME = kl3_romlib_test
|
||||
|
||||
#SUB_DIRS = $(TOPDIR)/common/os_shim/dtestos
|
||||
SUB_DIRS = $(TOPDIR)/dtest/dtest3/common
|
||||
|
||||
# .h files dir
|
||||
ADD_INCLUDE += $(TOPDIR)/plc/halphy/inc $(TOPDIR)/inc/compiler/gcc $(TOPDIR)/common/io_lib/inc $(TOPDIR)/inc $(TOPDIR)/inc/io_lib $(TOPDIR)/inc/driver $(TOPDIR)/inc/uart $(TOPDIR)/inc/plc_lib $(TOPDIR)/inc/ipc $(TOPDIR)/inc/os_shim $(TOPDIR)/inc/pkt $(TOPDIR)/inc/utils $(TOPDIR)/plc/inc $(TOPDIR)/inc/cli $(TOPDIR)/cli/communicator $(TOPDIR)/inc/dbglog $(TOPDIR)/inc/ftm $(TOPDIR)/plc/halmac/inc $(TOPDIR)/plc/halmac/hw/inc/desc $(TOPDIR)/driver/inc $(TOPDIR)/driver/inc/pib
|
||||
|
||||
PRE_MARCO += _MODULE_NAME_=\"LEDC\" _MODULE_VERSION_=\"V1.0.0\"
|
||||
|
||||
LD_SCRIPT = link_soc.lds
|
||||
OPT_FLAG = -Os -Wno-error=int-conversion
|
||||
|
||||
ifeq ($(gcc), arm)
|
||||
ADD_INCLUDE += $(TOPDIR)/os/freertos/src/portable/ARM_CM3
|
||||
else
|
||||
ADD_INCLUDE += $(TOPDIR)/os/freertos/src/portable/RISCV $(TOPDIR)/dtest/dtest3/common
|
||||
endif
|
||||
|
||||
ifeq ($(gcc),arm)
|
||||
ADD_LIB = cm3
|
||||
ADD_LIBDIR = $(TOPDIR)/startup/cm3
|
||||
else
|
||||
ifeq ($(target), kunlun3)
|
||||
ADD_LIB = riscv
|
||||
ADD_LIBDIR =$(TOPDIR)/startup/riscv3
|
||||
ADD_INCLUDE += $(TOPDIR)/driver/src/hw3/inc
|
||||
endif
|
||||
endif
|
||||
|
||||
# lib dir
|
||||
ADD_LIBDIR += $(TOPDIR)/driver $(TOPDIR)/common $(TOPDIR)/os
|
||||
# lib need to ld together
|
||||
ADD_LIB += os driver common
|
||||
|
||||
#####################################################
|
||||
|
||||
ifdef TOPDIR
|
||||
include $(TOPDIR)/build/makefile.cfg
|
||||
else
|
||||
include $(CURDIR)/build/makefile.cfg
|
||||
TOPDIR = $(CURDIR)
|
||||
export TOPDIR
|
||||
endif
|
||||
|
||||
dump:
|
||||
$(OBJDUMP) -D -S -l $(OUTPUT_FULL_NAME) > $(OUTPUT_FULL_NAME).dump
|
||||
|
||||
# display the obj files and output name
|
||||
debug:
|
||||
@echo TOPDIR=$(TOPDIR)
|
||||
@echo OUTPUT_LIB=$(OUTPUT_FULL_NAME)
|
||||
@echo DEPS=$(DEPS)
|
||||
@echo OBJECTS=$(OBJECTS)
|
||||
@echo SRCS=$(SRCS)
|
||||
@echo OBJECTS folder=$(foreach dirname, $(SUB_DIRS), $(addprefix $(BIN_DIR)/, $(dirname)))
|
||||
@echo output_name=$(OUTPUT_FULL_NAME)
|
140
dtest/dtest3/romlib_test/romlib_test.c
Normal file
140
dtest/dtest3/romlib_test/romlib_test.c
Normal file
@@ -0,0 +1,140 @@
|
||||
|
||||
#include "os_types.h"
|
||||
#include "dbg_io.h"
|
||||
#include "iot_io.h"
|
||||
#include "cpu.h"
|
||||
#include "watchdog.h"
|
||||
// #include "platform.h"
|
||||
#include "iot_gptmr_api.h"
|
||||
#include "iot_clock.h"
|
||||
#include "clk.h"
|
||||
#include "strformat.h"
|
||||
#include "uart.h"
|
||||
#include "string.h"
|
||||
|
||||
typedef int (*iot_sprintf_t)(char* str, const char* format, ...);
|
||||
typedef int (*iot_snprintf_t)(char* str, size_t size, const char* format, ...);
|
||||
typedef int (*iot_vsnprintf_t)(char* str, size_t size, const char* format, va_list ap);
|
||||
typedef int32_t (*iot_printf_t)(const char* fmt, ...);
|
||||
|
||||
typedef int (*format_str_t)(const str_format_context* ctxt, const char* format, ...);
|
||||
typedef int (*format_str_v_t)(const str_format_context* ctxt, const char* format, va_list ap);
|
||||
|
||||
typedef void* (*memmove_t)(void* dest, const void* src, size_t n);
|
||||
|
||||
iot_sprintf_t rom_iot_sprintf;
|
||||
iot_snprintf_t rom_iot_snprintf;
|
||||
iot_vsnprintf_t rom_iot_vsnprintf;
|
||||
iot_printf_t rom_iot_printf;
|
||||
iot_printf_t dtest_iot_printf;
|
||||
format_str_t rom_format_str;
|
||||
format_str_v_t rom_format_str_v;
|
||||
str_format_context* rom_log_ctxt;
|
||||
extern struct uart_ctrl uart_e_ctrl;
|
||||
|
||||
memmove_t rom_memmove;
|
||||
|
||||
#define PROVIDE(s) rom_##s
|
||||
|
||||
#define PUT_PORT 0
|
||||
|
||||
static void uart_flush(void)
|
||||
{
|
||||
while (uart_e_ctrl.tx_fifo_cnt(PUT_PORT)) __asm volatile("nop\n");
|
||||
return;
|
||||
}
|
||||
|
||||
static StrFormatResult uart_puts(void *user_data, const char *data, unsigned int len)
|
||||
{
|
||||
(void)user_data;
|
||||
uint8_t c;
|
||||
int i = 0;
|
||||
while (i < len) {
|
||||
c = *(data+i);
|
||||
if (c == '\n'){
|
||||
uart_e_ctrl.try_putc(PUT_PORT,'\r');
|
||||
}
|
||||
uart_e_ctrl.try_putc(PUT_PORT,c);
|
||||
i++;
|
||||
}
|
||||
uart_flush();
|
||||
return 0;
|
||||
}
|
||||
|
||||
int rom_iot_vsnprintf_test(char *str, size_t size, const char *format, ...)
|
||||
{
|
||||
int res;
|
||||
va_list ap;
|
||||
va_start(ap, format);
|
||||
res = rom_iot_vsnprintf(str, size, format, ap);
|
||||
va_end(ap);
|
||||
return res;
|
||||
}
|
||||
|
||||
#pragma GCC diagnostic ignored "-Wint-conversion"
|
||||
void fun_pointer_init() {
|
||||
PROVIDE(iot_sprintf = 0x0004455e);
|
||||
PROVIDE(iot_printf = 0x00044616);
|
||||
PROVIDE(iot_snprintf = 0x000445f6);
|
||||
PROVIDE(iot_vsnprintf = 0x000445ca);
|
||||
PROVIDE(log_ctxt = 0x100005a4);
|
||||
PROVIDE(format_str = 0x0004451e);
|
||||
PROVIDE(format_str_v = 0x0004451e);
|
||||
PROVIDE(memmove = 0x0004654e);
|
||||
rom_log_ctxt->write_str = uart_puts;
|
||||
dtest_iot_printf = (int)&iot_printf;
|
||||
}
|
||||
|
||||
int rom_format_str_v_test(const char *format, ...)
|
||||
{
|
||||
int res;
|
||||
va_list ap;
|
||||
va_start(ap, format);
|
||||
res = rom_format_str_v(rom_log_ctxt, format, ap);
|
||||
va_end(ap);
|
||||
return res;
|
||||
}
|
||||
|
||||
static char g_buff[1024];
|
||||
static char g_buff2[1024];
|
||||
int main(void) {
|
||||
iot_interrupt_init();
|
||||
dbg_uart_init();
|
||||
clk_core_init();
|
||||
clk_core_freq_set(CLK_FRQ_150M);
|
||||
fun_pointer_init();
|
||||
|
||||
|
||||
iot_printf("print by iot_printf()\n");
|
||||
|
||||
dtest_iot_printf("print by dtest_iot_printf()\n");
|
||||
|
||||
iot_snprintf(g_buff, 1024, "print by iot_snprintf()\n");
|
||||
iot_printf("%s", g_buff);
|
||||
|
||||
rom_iot_snprintf(g_buff, 1024, "print by rom_iot_snprintf()\n");
|
||||
iot_printf("%s", g_buff);
|
||||
|
||||
rom_iot_vsnprintf_test(g_buff, 1024, "print by rom_iot_vsnprintf()\n");
|
||||
iot_printf("%s", g_buff);
|
||||
|
||||
iot_printf("rom_iot_printf() test\n");
|
||||
rom_iot_printf("print by rom_iot_printf()\n");
|
||||
|
||||
iot_printf("rom_format_str() test\n");
|
||||
rom_format_str(rom_log_ctxt, "print by rom_format_str()\n");
|
||||
|
||||
iot_printf("rom_format_str_v() test\n");
|
||||
rom_format_str_v_test("print by rom_format_str_v()\n");
|
||||
|
||||
iot_printf("print test end\n");
|
||||
|
||||
memmove(g_buff, g_buff2, 1024);
|
||||
iot_printf("%s", g_buff);
|
||||
rom_memmove(g_buff, "print by rom_memmove()\n", 24);
|
||||
iot_printf("%s", g_buff);
|
||||
|
||||
while (1);
|
||||
|
||||
}
|
||||
|
@@ -41,7 +41,7 @@ extern "C" {
|
||||
#define GPIO_RS485_TXE 7
|
||||
#define GPIO_IR_TXD 8
|
||||
#define GPIO_IR_RXD 9
|
||||
#define GPIO_GEODE_OVT 10
|
||||
#define GPIO_GEODE_OVT 10 // 外部pa的gpio中断
|
||||
#define GPIO_SMART_BOOT_SEL 11
|
||||
#define GPIO_PM_CHARGE_EN 12
|
||||
#define GPIO_RST_CTRL 13
|
||||
|
@@ -85,7 +85,7 @@ extern "C" {
|
||||
#if ((TARGET_VERSION == TARGET_KUNLUN3) && !SUPPORT_SOUTHERN_POWER_GRID)
|
||||
|
||||
/* #define number of nodes supported in the PLC network must be (n * 8 - 1) */
|
||||
#define PLC_NETWORK_SCALE 2039
|
||||
#define PLC_NETWORK_SCALE 1535
|
||||
|
||||
#else /* (TARGET_VERSION == TARGET_KUNLUN3) */
|
||||
|
||||
|
@@ -40,7 +40,8 @@ extern "C" {
|
||||
#define TARGET_KUNLUN3 3
|
||||
|
||||
#ifndef TARGET_VERSION
|
||||
#define TARGET_VERSION TARGET_KUNLUN
|
||||
#define TARGET_VERSION 5
|
||||
#error "please define TARGET_VERSION in Makefile"
|
||||
#endif
|
||||
|
||||
/* production line defination, plc by default */
|
||||
|
@@ -112,18 +112,18 @@ extern "C" {
|
||||
#define CHIP_ID_GX2011_V1A 0x1041 //GX2011
|
||||
/* HZ5202, k76, QFN9*9 */
|
||||
#define CHIP_ID_HZ5202_V1A 0x1057 //HZ5202
|
||||
/* DT0530, k76, QFN9*9 */
|
||||
#define CHIP_ID_DT0530_V1A 0x1063 //DT0530
|
||||
/* DT0531, k76, QFN9*9 */
|
||||
#define CHIP_ID_DT0531_V1A 0x1061 //DT0531
|
||||
/* WTZ31C, k76, QFN9*9 */
|
||||
#define CHIP_ID_WTZ31C_V1A 0x1063 //WTZ31C
|
||||
/* WTZ31S, k76, QFN9*9 */
|
||||
#define CHIP_ID_WTZ31S_V1A 0x1061 //WTZ31S
|
||||
/* YP8801, k76, QFN9*9 */
|
||||
#define CHIP_ID_YP8801_V1A 0x1073 //YP8801
|
||||
/* YP8811, k76, QFN9*9 */
|
||||
#define CHIP_ID_YP8811_V1A 0x1071 //YP8811
|
||||
/* WTZ31C, k76, QFN9*9 */
|
||||
#define CHIP_ID_WTZ31C_V1A 0x1083 //WTZ31C
|
||||
/* WTZ31S, k76, QFN9*9 */
|
||||
#define CHIP_ID_WTZ31S_V1A 0x1081 //WTZ31S
|
||||
/* DT0530, k76, QFN9*9 */
|
||||
#define CHIP_ID_DT0530_V1A 0x1083 //DT0530
|
||||
/* DT0531, k76, QFN9*9 */
|
||||
#define CHIP_ID_DT0531_V1A 0x1081 //DT0531
|
||||
/* TCE3202, k76, QFN9*9 */
|
||||
#define CHIP_ID_TCE3202_V1A 0x1093 //TCE3202
|
||||
/* TCE3201, k76, QFN9*9 */
|
||||
|
@@ -27,7 +27,7 @@
|
||||
#define LEDC0_OUT_INV_MASK 0x00000200
|
||||
#define LEDC0_IDLE_LV_OFFSET 8
|
||||
#define LEDC0_IDLE_LV_MASK 0x00000100
|
||||
#define LEDC0_TIMER_SEL_OFFSET 0
|
||||
#define LEDC0_TIMER_SEL_OFFSET 0 // 每个通道使用公共定时器的时候可以选择定时器?
|
||||
#define LEDC0_TIMER_SEL_MASK 0x000000FF
|
||||
|
||||
//-----------------------------------
|
||||
|
@@ -8,10 +8,13 @@ CC = gcc
|
||||
|
||||
ifeq ($(target), kunlun2)
|
||||
hw_dep = hw2
|
||||
CFLAGS += -DTARGET_VERSION=2
|
||||
else ifeq ($(target), kunlun3)
|
||||
hw_dep = hw3
|
||||
CFLAGS += -DTARGET_VERSION=3
|
||||
else
|
||||
hw_dep = hw
|
||||
CFLAGS += -DTARGET_VERSION=1
|
||||
endif
|
||||
|
||||
ifeq ($(TOPDIR),)
|
||||
|
@@ -1951,25 +1951,25 @@ static void ramModuleInfoPrint()
|
||||
}
|
||||
}
|
||||
#ifndef RAM_FOR_BOARDBURN
|
||||
{
|
||||
/* chipburn */
|
||||
uint32_t subid;
|
||||
ram_encrypt_t *p_encrypt = &encrypt_array[MANUFACTURER_INDEX];
|
||||
// {
|
||||
// /* chipburn */
|
||||
// uint32_t subid;
|
||||
// ram_encrypt_t *p_encrypt = &encrypt_array[MANUFACTURER_INDEX];
|
||||
|
||||
if (0 == g_chip_subid) {
|
||||
/* chipburn, when no subid */
|
||||
subid = ram_lookup_chip_subid(g_chip_id, p_encrypt->manu);
|
||||
if (0xFFFF == subid) {
|
||||
ram_error_no |= RAM_LOOKUP_CHIP_SUBID_ERR;
|
||||
} else {
|
||||
ram_set_chip_subid(subid);
|
||||
g_chip_subid = ram_get_chip_subid();
|
||||
if (subid != g_chip_subid) {
|
||||
ram_error_no |= RAM_WRITE_CHIP_SUBID_ERR;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// if (0 == g_chip_subid) {
|
||||
// /* chipburn, when no subid */
|
||||
// subid = ram_lookup_chip_subid(g_chip_id, p_encrypt->manu);
|
||||
// if (0xFFFF == subid) {
|
||||
// ram_error_no |= RAM_LOOKUP_CHIP_SUBID_ERR;
|
||||
// } else {
|
||||
// ram_set_chip_subid(subid);
|
||||
// g_chip_subid = ram_get_chip_subid();
|
||||
// if (subid != g_chip_subid) {
|
||||
// ram_error_no |= RAM_WRITE_CHIP_SUBID_ERR;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
#endif
|
||||
|
||||
gPsramSize = ram_get_psram_size();
|
||||
|
@@ -233,13 +233,13 @@ void heap_alloc_caps_init(unsigned int reserved_sz);
|
||||
|
||||
void *pvPortMallocTagged( size_t xWantedSize, BaseType_t tag )
|
||||
{
|
||||
BlockLink_tag_t *pxBlock, *pxPreviousBlock, *pxNewBlockLink;
|
||||
void *pvReturn = NULL;
|
||||
BlockLink_tag_t *pxBlock, *pxPreviousBlock, *pxNewBlockLink;
|
||||
void *pvReturn = NULL;
|
||||
|
||||
/* The heap must be initialised before the first call to
|
||||
prvPortMalloc(). */
|
||||
//configASSERT( tagpxEnd );
|
||||
|
||||
// 这里实际分配内存
|
||||
vTaskSuspendAll();
|
||||
{
|
||||
if (NULL == tagpxEnd) {
|
||||
@@ -274,7 +274,8 @@ void *pvReturn = NULL;
|
||||
one of adequate size is found. */
|
||||
pxPreviousBlock = &tagxStart;
|
||||
pxBlock = tagxStart.pxNextFreeBlock;
|
||||
while( ( ( pxBlock->xTag != tag ) || ( pxBlock->xBlockSize < xWantedSize ) ) && ( pxBlock->pxNextFreeBlock != NULL ) )
|
||||
// 从第一个内存池开始 找到一个能够分配指定内存大小的内存池
|
||||
while (((pxBlock->xTag != tag) || (pxBlock->xBlockSize < xWantedSize)) && (pxBlock->pxNextFreeBlock != NULL))
|
||||
{
|
||||
pxPreviousBlock = pxBlock;
|
||||
pxBlock = pxBlock->pxNextFreeBlock;
|
||||
|
@@ -218,9 +218,12 @@ interrupt:
|
||||
.global entry_mip
|
||||
.global entry_mcause
|
||||
|
||||
|
||||
// cpu产生异常时会自动进入这个入口
|
||||
trap_entry:
|
||||
|
||||
/* Interrupt trap */
|
||||
// 把t0的值暂时保存到临时寄存器中
|
||||
csrw mscratch, t0
|
||||
/* 保存mcause && mip 到pmpaddr中 */
|
||||
csrr t0, mcause
|
||||
@@ -228,11 +231,15 @@ trap_entry:
|
||||
csrr t0, mip
|
||||
csrw pmpaddr15, t0
|
||||
|
||||
// 在线程栈中直接处理中断
|
||||
andi t0, t0, -1912 // -1912 = 0x888
|
||||
// bnez不会更新返回地址 jal x1 会把返回地址更新到ra
|
||||
bnez t0, interrupt
|
||||
|
||||
/* System call and other traps */
|
||||
// 把mscratch的值拷贝到t0中 然后把sp的值写入到mscratch
|
||||
csrrw t0, mscratch, sp
|
||||
// 切到异常处理栈
|
||||
la sp, _trap_sp
|
||||
#ifndef __riscv_float_abi_soft
|
||||
addi sp, sp, -REGBYTES*64
|
||||
|
@@ -1004,8 +1004,8 @@ else
|
||||
|
||||
# prepare oem.bin
|
||||
cp $TOP_DIR/sbl/.output/lib/kunlun_sbl.bin $CUR_DIR/sbl.bin
|
||||
cp $TOP_DIR/mfgtool/ram/.output/lib/kl1_ram.bin $CUR_DIR/ram.bin
|
||||
cp $TOP_DIR/mfgtool/ram/.output/lib/kl1_ram*.bin $CUR_DIR
|
||||
cp $TOP_DIR/mfgtool/ram/.output/lib/kl${CHIP_VER_UPPER}_ram.bin $CUR_DIR/ram.bin
|
||||
cp $TOP_DIR/mfgtool/ram/.output/lib/kl${CHIP_VER_UPPER}_ram*.bin $CUR_DIR
|
||||
cp $TOP_DIR/sp/boot/.output/lib/sp_fw.bin $CUR_DIR/sp.bin
|
||||
|
||||
if [ "${IMG_UPPER}" == "FTM" ] || [ "${IMG_UPPER}" == "CKB" ]; then
|
||||
|
Reference in New Issue
Block a user