[Camera] 支援 VEYE IMX462 1080p MIPI 攝影機模組

- 撰寫新專案solution_kdp2_hico_mipi_ARCI支援VEYE IMX462相機模組
- I2C 通訊:跳過 IMX462 ID 讀取,避開底層 Repeated Start 的物理時序衝突
- 對相機模組Reset pin 輸出 high 使相機模組開機
- 系統時脈:調校 PLL3 震盪與分頻器,並設定 MIPI PHY 參數,穩定高頻訊號接收
- 頻寬優化:修改 D2A FIFO 閾值 (0x5000),解決 AHB 匯流排溢位與畫面撕裂
- 記憶體調整:增加記憶體空間來存影像,並縮減 Buffer 數量
This commit is contained in:
Dereck Hao 2026-03-25 15:06:56 +08:00
parent 4b11341799
commit b761fc3148
35 changed files with 5032 additions and 25 deletions

View File

@ -6,6 +6,7 @@
#include "cmsis_os2.h"
#include "kdrv_i2c.h"
#include "kdrv_gpio.h"
#include "kdrv_pinmux.h"
#include "kmdw_console.h"
@ -27,6 +28,14 @@ int hw_test_i2c_run(void)
kmdw_printf("Starting I2C Bus Scan Test...\n");
// Release Sensor Reset (PIO17)
kmdw_printf("Releasing Sensor Reset (PIO17 -> High)...\n");
kdrv_pinmux_config(KDRV_PIN_LC_DATA_0, PIN_MODE_3, PIN_PULL_NONE, PIN_DRIVING_8MA);
kdrv_gpio_set_attribute(GPIO_PIN_11, GPIO_DIR_OUTPUT);
kdrv_gpio_write_pin(GPIO_PIN_11, 1);
osDelay(10); // Wait for sensor to stabilize after reset release
// 1. Configure Pinmux for I2C0
kmdw_printf("Configuring pins for I2C0...\n");
kdrv_pinmux_config(KDRV_PIN_I2C0_SCL, PIN_MODE_0, PIN_PULL_NONE, PIN_DRIVING_8MA);
@ -116,19 +125,19 @@ int hw_test_i2c_run(void)
}
}
// kmdw_printf("---------------------------------------------------------\n");
// kmdw_printf("Checking for VEYE-MIPI-IMX462 sensor at address 0x%02X...\n", VEYE_IMX462_I2C_ADDR);
kmdw_printf("---------------------------------------------------------\n");
kmdw_printf("Checking for VEYE-MIPI-IMX462 sensor at address 0x%02X...\n", VEYE_IMX462_I2C_ADDR);
// // Probe for VEYE-MIPI-IMX462
// // We use a 0-length write to check if the device ACKs the address.
// status = kdrv_i2c_write_register(KDRV_I2C_CTRL_0, VEYE_IMX462_I2C_ADDR, 0, 0, 0, NULL);
// Probe for VEYE-MIPI-IMX462
// We use a 0-length write to check if the device ACKs the address.
status = kdrv_i2c_write_register(KDRV_I2C_CTRL_0, VEYE_IMX462_I2C_ADDR, 0, 0, 0, NULL);
// if (status == KDRV_STATUS_OK) {
// kmdw_printf(" VEYE-MIPI-IMX462 detected at 0x%02X! -> PASSED\n", VEYE_IMX462_I2C_ADDR);
// result = 0; // Passed if at least one supported sensor is found
// } else {
// kmdw_printf(" No response at 0x%02X. (Not connected or different address)\n", VEYE_IMX462_I2C_ADDR);
// }
if (status == KDRV_STATUS_OK) {
kmdw_printf(" VEYE-MIPI-IMX462 detected at 0x%02X! -> PASSED\n", VEYE_IMX462_I2C_ADDR);
result = 0; // Passed if at least one supported sensor is found
} else {
kmdw_printf(" No response at 0x%02X. (Not connected or different address)\n", VEYE_IMX462_I2C_ADDR);
}
kmdw_printf("=========================================================\n");
kmdw_printf("Test finished. Returning to main menu...\n");

View File

@ -0,0 +1,33 @@
/* --------------------------------------------------------------------------
* Copyright (c) 2018-2019 Kneron Inc. All rights reserved.
*
* Name: main.c
* Purpose: Kneron NCPU
*
*---------------------------------------------------------------------------*/
#include "cmsis_os2.h"
#include "kdpio.h"
extern void SystemCoreClockUpdate(void);
/*----------------------------------------------------------------------------
* Main: Initialize OS Kernel and NCPU SDK
*---------------------------------------------------------------------------*/
int main(void)
{
SystemCoreClockUpdate();
osKernelInitialize();
/* init NCPU */
kdpio_sdk_init();
if (osKernelGetState() == osKernelReady)
{
osKernelStart();
}
while (1)
;
}

View File

@ -0,0 +1,48 @@
/* --------------------------------------------------------------------------
* Copyright (c) 2018-2020 Kneron Inc. All rights reserved.
*
* Name: ncpu_extend_ftr.c
* Purpose: Extend new features implementation
*
*---------------------------------------------------------------------------*/
#include "kdpio.h"
#include "model_type.h"
#include "model_ppp.h"
/*********************************************************************************
Registered model pre-process features list
only need to register functions for models that default builtin pre-proc can't support
*********************************************************************************/
model_pre_post_func_t model_pre_proc_fns[MAX_MODEL_REGISTRATIONS] = {
/* < model type ID > < pre-process function > */
/* -------------------------------------------------------------------------- */
0 // no pre-process function specified
/* Put customized pre-process functions below:
{ CUSTOMER_MODEL_1, preproc_customer_model_1 },
{ CUSTOMER_MODEL_2, preproc_customer_model_2 },
{ CUSTOMER_MODEL_3, preproc_customer_model_3 },
*/
};
/*********************************************************************************
Registered model post-process features list
*********************************************************************************/
model_pre_post_func_t model_post_proc_fns[MAX_MODEL_REGISTRATIONS] = {
/* < model type ID > < post-process function > */
/* -------------------------------------------------------------------------- */
{ TINY_YOLO_V3_224_224_3, post_yolov3_optimized },
{ TINY_YOLO_V3_416_416_3, post_yolov3_optimized },
{ TINY_YOLO_V3_608_608_3, post_yolov3_optimized },
{ KNERON_YOLOV5S_PersonBicycleCarMotorcycleBusTruckCatDog8_480_256_3, post_yolov5_optimized },
/* Put customized post-process functions below:
{ CUSTOMER_MODEL_1, post_customer_model_1 },
{ CUSTOMER_MODEL_2, post_customer_model_2 },
{ CUSTOMER_MODEL_3, post_customer_model_3 },
*/
};

View File

@ -0,0 +1,82 @@
/*
* Kneron Application initialization
*
* Copyright (C) 2022 Kneron, Inc. All rights reserved.
*
*/
#include <stdio.h>
#include "cmsis_os2.h"
// power manager
#include "kmdw_power_manager.h"
// inference core
#include "kp_struct.h"
#include "kmdw_console.h"
#include "kmdw_inference_app.h"
// inference app
#include "kdp2_inf_app_yolo.h"
// inference client
extern int kdp2_hico_mipi_init(void);
#define MAX_IMAGE_COUNT 10 /**< MAX inference input queue slot count */
#define MAX_RESULT_COUNT 10 /**< MAX inference output queue slot count */
//sync with kdp2_hico_mipi.c
/**
* @brief To register AI applications
* @param[in] num_input_buf number of data inputs in list
* @param[in] inf_input_buf_list list of data input for inference task
* @return N/A
* @note Add a switch case item for a new inf_app application
*/
static void _app_func(int num_input_buf, void** inf_input_buf_list);
void _app_func(int num_input_buf, void** inf_input_buf_list)
{
// check header stamp
if (0 >= num_input_buf) {
kmdw_printf("No input buffer for app function\n");
return;
}
kp_inference_header_stamp_t *header_stamp = (kp_inference_header_stamp_t *)inf_input_buf_list[0];
uint32_t job_id = header_stamp->job_id;
switch (header_stamp->job_id)
{
case KDP2_INF_ID_APP_YOLO:
kdp2_app_yolo_inference(job_id, num_input_buf, inf_input_buf_list);
break;
case KDP2_JOB_ID_APP_YOLO_CONFIG_POST_PROC:
kdp2_app_yolo_config_post_process_parameters(job_id, num_input_buf, inf_input_buf_list);
break;
default:
kmdw_inference_app_send_status_code(job_id, KP_FW_ERROR_UNKNOWN_APP);
break;
}
}
void app_initialize(void)
{
info_msg(">> Start running KL520 KDP2 HICO MIPI mode ...\n");
// for shutdown command
kmdw_power_manager_init();
/* initialize inference app */
/* register APP functions */
/* specify depth of inference queues */
kmdw_inference_app_init(_app_func, MAX_IMAGE_COUNT, MAX_RESULT_COUNT);
/* HICO mode init */
kdp2_hico_mipi_init();
return;
}

View File

@ -0,0 +1,25 @@
/********************************************************************
* Copyright (c) 2020 Kneron, Inc. All Rights Reserved.
*
* The information contained herein is property of Kneron, Inc.
* Terms and conditions of usage are described in detail in Kneron
* STANDARD SOFTWARE LICENSE AGREEMENT.
*
* Licensees are granted free, non-transferable use of the information.
* NO WARRANTY of ANY KIND is provided. This heading must NOT be removed
* from the file.
********************************************************************/
//Include
#include "project.h"
#if defined(FLASH_TYPE) && (FLASH_TYPE == FLASH_TYPE_NULL)
#include "kdev_flash_null.h"
#else
#include "kdev_flash.h"
#endif
//Function
void dev_initialize(void)
{
kdev_flash_initialize();
}

View File

@ -0,0 +1,41 @@
/*
*
* Copyright (C) 2020 Kneron, Inc. All rights reserved.
*
*/
#include <string.h>
#include <stdlib.h>
#include "cmsis_os2.h"
#include "kmdw_display.h"
#include "kmdw_console.h"
static int display_inited = 0;
void display_init(uint32_t input_fmt, uint16_t xres, uint16_t yres, uint8_t cam_idx)
{
struct video_input_params params;
if (display_inited == 0) {
params.input_fmt = input_fmt;
params.input_xres = xres;
params.input_yres = yres;
kmdw_video_renderer_open(&params);
kmdw_video_renderer_set_camera(cam_idx);
kmdw_display_set_pen_rgb565(BLACK, 1);
kmdw_video_renderer_buffer_initialize(&params);
kmdw_video_renderer_start();
display_inited = 1;
kmdw_printf("input_fmt=0x%x, input_xres=%d, input_yres=%d, cam_idx=%d \n",params.input_fmt, params.input_xres, params.input_yres, cam_idx);
}
}
void display_exit(void)
{
if (display_inited == 1) {
kmdw_video_renderer_stop();
display_inited = 0;
}
}

View File

@ -0,0 +1,47 @@
/********************************************************************
* Copyright (c) 2020 Kneron, Inc. All Rights Reserved.
*
* The information contained herein is property of Kneron, Inc.
* Terms and conditions of usage are described in detail in Kneron
* STANDARD SOFTWARE LICENSE AGREEMENT.
*
* Licensees are granted free, non-transferable use of the information.
* NO WARRANTY of ANY KIND is provided. This heading must NOT be removed
* from the file.
********************************************************************/
#include "project.h"
#include "kdrv_uart.h"
#include "kdrv_ddr.h"
#include "kdrv_pinmux.h"
#include "kdrv_timer.h"
#include "kdrv_i2c.h"
#include "kdrv_gpio.h"
#include "kmdw_camera.h"
static uint32_t pinmux_array[PIN_NUM] = PINMUX_ARRAY;
void drv_initialize(void)
{
kdrv_uart_initialize();
kdrv_pinmux_initialize(PIN_NUM, pinmux_array);
kdrv_ddr_system_init(DDR_INIT_ALL); // TODO, not 720 style
kdrv_i2c_initialize(KDRV_I2C_CTRL_0, KDRV_I2C_SPEED_400K);
//kdrv_gpio_initialize(GPIO_NUM, gpio_attr_ctx);
//kdrv_timer_initialize();
//kdrv_timer_perf_measure_start();
/* Init these functions in kmdw_camera_init on 520
for(uint32_t cam_id = 0; cam_id < CAM_ID_MAX ; cam_id++)
{
if(cam_ctx[cam_id].cam_input_type!= IMG_SRC_IN_PORT_NONE)
{
kdrv_csirx_initialize(cam_id);
kdrv_dpi2ahb_initialize(cam_id);
}
}
*/
}

View File

@ -0,0 +1,31 @@
/********************************************************************
* Copyright (c) 2022 Kneron, Inc. All Rights Reserved.
*
* The information contained herein is property of Kneron, Inc.
* Terms and conditions of usage are described in detail in Kneron
* STANDARD SOFTWARE LICENSE AGREEMENT.
*
* Licensees are granted free, non-transferable use of the information.
* NO WARRANTY of ANY KIND is provided. This heading must NOT be removed
* from the file.
********************************************************************/
/**@addtogroup APPLICATION_INIT
* @{
* @brief Kneron application init
* @copyright Copyright (C) 2022 Kneron, Inc. All rights reserved.
*/
#ifndef __APPLICATION_INIT_H__
#define __APPLICATION_INIT_H__
/**
* @brief app_initialize
*
* Add application layer initialization code
*
* @return void
*/
void app_initialize(void);
#endif

View File

@ -0,0 +1,29 @@
/********************************************************************
* Copyright (c) 2020 Kneron, Inc. All Rights Reserved.
*
* The information contained herein is property of Kneron, Inc.
* Terms and conditions of usage are described in detail in Kneron
* STANDARD SOFTWARE LICENSE AGREEMENT.
*
* Licensees are granted free, non-transferable use of the information.
* NO WARRANTY of ANY KIND is provided. This heading must NOT be removed
* from the file.
********************************************************************/
/**@addtogroup DEVICE_INIT
* @{
* @brief Kneron device init
* @copyright Copyright (C) 2020 Kneron, Inc. All rights reserved.
*/
#ifndef __DEVICE_INIT_H__
#define __DEVICE_INIT_H__
/**
* @brief dev_initialize
*
* @return void
*/
void dev_initialize(void);
#endif

View File

@ -0,0 +1,29 @@
/********************************************************************
* Copyright (c) 2020 Kneron, Inc. All Rights Reserved.
*
* The information contained herein is property of Kneron, Inc.
* Terms and conditions of usage are described in detail in Kneron
* STANDARD SOFTWARE LICENSE AGREEMENT.
*
* Licensees are granted free, non-transferable use of the information.
* NO WARRANTY of ANY KIND is provided. This heading must NOT be removed
* from the file.
********************************************************************/
/**@addtogroup SYSTEM_INIT
* @{
* @brief Kneron System init
* @copyright Copyright (C) 2020 Kneron, Inc. All rights reserved.
*/
#ifndef __DRIVER_INIT_H__
#define __DRIVER_INIT_H__
/**
* @brief drv_initialize
*
* @return void
*/
void drv_initialize(void);
#endif

View File

@ -0,0 +1,70 @@
/**
* @file hico_mipi.h
* @brief macros and data structure for hico application of mipi camera
* @version 0.1
* @date 2021-07-02
*
* @copyright Copyright (c) 2021 Kneron Inc. All rights reserved.
*/
#pragma once
#define JID_START_HICO_MIPI 1000 // job ID to tell FW that this customized command attends to configure camera and hico mipi parameters
#define JID_CAM_0_IMAGE 2000 // job ID for camera sensor 0 image
#define JID_CAM_1_IMAGE 2001 // job ID for camera sensor 1 image
#define JID_CAM_2_IMAGE 2002 // job ID for camera sensor 2 image
#define JID_CAM_3_IMAGE 2003 // job ID for camera sensor 3 image
#define JID_CAM_0_INF_RESULT 3000 // job ID for camera sensor 0 inference result
#define JID_CAM_1_INF_RESULT 3001 // job ID for camera sensor 1 inference result
#define JID_CAM_2_INF_RESULT 3002 // job ID for camera sensor 2 inference result
#define JID_CAM_3_INF_RESULT 3003 // job ID for camera sensor 3 inference result
#define KDP2_INF_ID_APP_YOLO 11 // job ID for configuring yolo application
typedef enum
{
// MODE_SELF_TEST = 0, add this one ?
MODE_NONE = 0,
MODE_LIVE_VIEW = 1, // only show image, not doing inference
MODE_LIVE_VIEW_INF = 2, // show image with the inference result
} hico_mode_t;
typedef enum
{
CAM_SENSOR_NONE = 0x0,
CAM_SENSOR_0 = 0x1,
CAM_SENSOR_1 = 0x2,
CAM_SENSOR_2 = 0x4,
CAM_SENSOR_3 = 0x8,
} sensor_selection_t;
// FIXME: Add resolution and inference model type as the future work ??
// need to know how to adjust the resolution of the camera
// currently model type is yolo v5s only
typedef struct
{
/* header stamp is necessary for data transfer between host and device */
kp_inference_header_stamp_t header_stamp;
uint32_t mode; // hico_mode_t
uint32_t sensor_sel; // sensor_selection_t bit fields
uint32_t app_job_id; // job id for application
} __attribute__((aligned(4))) hico_mipi_config_command_t;
typedef struct
{
uint32_t img_width; // in pixel
uint32_t img_height; // in pixel
uint32_t img_format; // kp_image_format_t
} __attribute__((aligned(4))) hico_mipi_camera_settings_t;
#define MAX_NUM_SENSOR 4
typedef struct
{
/* header stamp is necessary for data transfer between host and device */
kp_inference_header_stamp_t header_stamp;
uint32_t num_cam_sensors;
hico_mipi_camera_settings_t cam_settings[MAX_NUM_SENSOR];
} __attribute__((aligned(4))) hico_mipi_config_response_t;

View File

@ -0,0 +1,29 @@
/********************************************************************
* Copyright (c) 2020 Kneron, Inc. All Rights Reserved.
*
* The information contained herein is property of Kneron, Inc.
* Terms and conditions of usage are described in detail in Kneron
* STANDARD SOFTWARE LICENSE AGREEMENT.
*
* Licensees are granted free, non-transferable use of the information.
* NO WARRANTY of ANY KIND is provided. This heading must NOT be removed
* from the file.
********************************************************************/
/**@addtogroup MIDDLEWARE_INIT
* @{
* @brief Kneron middleware init
* @copyright Copyright (C) 2020 Kneron, Inc. All rights reserved.
*/
#ifndef __MIDDLEWARE_INIT_H__
#define __MIDDLEWARE_INIT_H__
/**
* @brief mdw_initialize
*
* @return void
*/
void mdw_initialize(void);
#endif

View File

@ -0,0 +1,28 @@
/********************************************************************
* Copyright (c) 2020 Kneron, Inc. All Rights Reserved.
*
* The information contained herein is property of Kneron, Inc.
* Terms and conditions of usage are described in detail in Kneron
* STANDARD SOFTWARE LICENSE AGREEMENT.
*
* Licensees are granted free, non-transferable use of the information.
* NO WARRANTY of ANY KIND is provided. This heading must NOT be removed
* from the file.
********************************************************************/
/**@addtogroup SYSTEM_INIT
* @{
* @brief Kneron System init
* @copyright Copyright (C) 2020 Kneron, Inc. All rights reserved.
*/
#ifndef __SYSTEM_INIT_H__
#define __SYSTEM_INIT_H__
/**
* @brief sys_initialize
*
* @return void
*/
void sys_initialize(void);
#endif

View File

@ -0,0 +1,89 @@
/********************************************************************
* Copyright (c) 2020 Kneron, Inc. All Rights Reserved.
*
* The information contained herein is property of Kneron, Inc.
* Terms and conditions of usage are described in detail in Kneron
* STANDARD SOFTWARE LICENSE AGREEMENT.
*
* Licensees are granted free, non-transferable use of the information.
* NO WARRANTY of ANY KIND is provided. This heading must NOT be removed
* from the file.
********************************************************************/
/**@addtogroup TASK_HANDLER
* @{
* @brief Kneron System init
* @copyright Copyright (C) 2020 Kneron, Inc. All rights reserved.
*/
#ifndef _TASK_HANDLER_H
#define _TASK_HANDLER_H
#include "cmsis_os2.h"
// #include "project.h"
#define USB_HOST
/******************************************************************************
Declaration of data structure
******************************************************************************/
// Sec 5: structure, uniou, enum, linked list
typedef struct
{
//parameters for creating tasks
const char caName[8]; //now, len=8
osThreadId_t *tTaskHandle;
osThreadFunc_t fpEntry;
const uint32_t dwStackSize;
osPriority_t dwPriority;
//parameters for creating queue
osMessageQueueId_t *tQueueHandle;
const uint32_t tQmsg_count;
const uint32_t tQmsg_size;
}T_S_KneronTask;
osThreadId_t task_log_handle;
osThreadId_t task_infdata_handle;
osThreadId_t task_infcb_handle;
osThreadId_t task_usb_cmd_handle;
osThreadId_t task_usb_image_handle;
osThreadId_t task_usb_result_handle;
osThreadId_t task_buf_mgr_handle;
// put osMessageQueueId_t objects here for setting tQueueHandle
extern void logger_thread(void *arg);
extern void kmdw_inference_image_dispatcher_thread(void *argument);
extern void kmdw_inference_result_handler_callback_thread(void *argument);
extern void kdp2_hico_mipi_usb_cmd_thread(void *arg);
extern void kdp2_hico_mipi_usb_img_send_back_thread(void *arg);
extern void kdp2_hico_mipi_usb_result_thread(void *arg);
extern void kdp2_fifoq_manager_enqueue_image_thread(void *arg);
/******************************************************************************
Declaration of Global Variables & Functions
******************************************************************************/
// Sec 6: declaration of global variable
T_S_KneronTask g_atKneronTaskPool[]=
{
// TaskName TaskHandle TaskFuncEntry TaskStack TaskPriority QueueHandle QueueMsgCount QueueMsgSize
//------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
{"LogTask", &task_log_handle, logger_thread, 1024, osPriorityBelowNormal, NULL, 0, 0 },
{"Infdata", &task_infdata_handle, kmdw_inference_image_dispatcher_thread, 2048, osPriorityNormal, NULL, 0, 0 },
{"Infcb", &task_infcb_handle, kmdw_inference_result_handler_callback_thread, 1024, osPriorityNormal, NULL, 0, 0 },
{"usbcmd", &task_usb_cmd_handle, kdp2_hico_mipi_usb_cmd_thread, 1024, osPriorityNormal, NULL, 0, 0 },
{"usbimg", &task_usb_image_handle, kdp2_hico_mipi_usb_img_send_back_thread, 1024, osPriorityNormal, NULL, 0, 0 },
{"usbrslt ", &task_usb_result_handle, kdp2_hico_mipi_usb_result_thread, 1024, osPriorityNormal, NULL, 0, 0 },
{"buf_mgr", &task_buf_mgr_handle, kdp2_fifoq_manager_enqueue_image_thread, 1024, osPriorityHigh, NULL, 0, 0 },
//
//Follow above format to add your TASK here
//
//end of table, don't remove it
//------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
{NULL,NULL,NULL,0,0,NULL,0,0}
//------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
};
#endif

View File

@ -0,0 +1,221 @@
/*
* Kneron VEYE-MIPI-IMX462 sensor driver
*
* Copyright (C) 2023 Kneron, Inc. All rights reserved.
*
*/
#include <stdlib.h>
#include "utility.h"
#include "board.h"
#include "kdev_sensor.h"
#include "kdrv_i2c.h"
#include "kdrv_gpio.h"
#include "kdrv_pinmux.h"
#include "cmsis_os2.h"
#include "kmdw_console.h"
#define IMX462_DBG
#ifdef IMX462_DBG
#define sensor_msg(fmt, ...) kmdw_printf("[%s] " fmt, __func__, ##__VA_ARGS__)
#else
#define sensor_msg(fmt, ...)
#endif
static const struct sensor_datafmt_info imx462_colour_fmts[] = {
{ PIX_FMT_RGB565, COLORSPACE_RGB },
{ PIX_FMT_YCBCR, COLORSPACE_YUV },
{ PIX_FMT_RAW10, COLORSPACE_RAW },
{ PIX_FMT_RAW8, COLORSPACE_RAW },
};
static struct sensor_device imx462_dev = {
.addr = 0x3B,
};
struct sensor_init_seq imx462_init_regs[] = {
/*
* VEYE-MIPI-IMX462 has an internal ISP that self-initializes.
* No complex init sequence is required.
* Refer to cs_mipi_i2c.sh for specific parameter configurations (WDR, Format, etc.)
* and add them here if needed.
*/
// 範例:如果你想要一啟動就預設一些 VEYE 參數,可以加在這裡
// {0x05, 0x00}, // Day/Night Mode: 0x00=Day(彩色), 0x01=Night(黑白), 0x02=Auto
// {0x0B, 0x01}, // WDR (寬動態): 0x00=Off, 0x01=On
// {0x09, 0x03}, // Image Flip/Mirror: 0x00=Normal, 0x01=Mirror, 0x02=Flip, 0x03=Mirror+Flip
// 設定 YUV 輸出順序 (0x1E)
// 0x00 = UYVY, 0x01 = YUYV (KL520 預期接收 YUYV)
// {0x1E, 0x01},
// {0x1B, 0x03},
{0x00, 0x00},
};
static uint32_t kdev_sensor_get_dev_id(void);
static uint32_t imx462_write_reg(struct sensor_device *sensor_dev, uint16_t reg, uint8_t data)
{
uint32_t ret;
// VEYE ISP typically uses 8-bit register addresses (1 byte)
ret = kdrv_i2c_write_register(KDRV_I2C_CTRL_0, sensor_dev->addr, reg, 1, 1, &data);
if (ret != KDRV_STATUS_OK) {
sensor_msg("I2C write failed, reg: 0x%02X, ret: %d\n", reg, ret);
}
osDelay(5); // 給予相機內部的 MCU 緩衝時間處理寫入指令
return ret;
}
static uint32_t imx462_read_reg(struct sensor_device *sensor_dev, uint16_t reg, uint8_t *data)
{
uint32_t ret;
// VEYE ISP uses 8-bit register addresses.
// KL520 underlying I2C driver has been fixed to support perfect Repeated Start without Arbitration Lost.
ret = kdrv_i2c_read_register(KDRV_I2C_CTRL_0, sensor_dev->addr, reg, 1, 1, data);
if (ret != KDRV_STATUS_OK) {
sensor_msg("I2C read failed, reg: 0x%02X, ret: %d\n", reg, ret);
}
return ret;
}
uint32_t imx462_init(struct sensor_device *sensor_dev, struct sensor_init_seq *seq)
{
struct sensor_device *dev = sensor_dev;
struct sensor_init_seq *init_fnc_ptr;
// Release Sensor Reset (PIO17) before communicating
sensor_msg("Releasing Sensor Reset...\n");
kdrv_pinmux_config(KDRV_PIN_LC_DATA_0, PIN_MODE_3, PIN_PULL_NONE, PIN_DRIVING_8MA);
kdrv_gpio_set_attribute(GPIO_PIN_11, GPIO_DIR_OUTPUT);
// Assert Reset (Active Low)
kdrv_gpio_write_pin(GPIO_PIN_11, 0);
osDelay(100);
// Release Reset
kdrv_gpio_write_pin(GPIO_PIN_11, 1);
osDelay(100); // Wait 0.1 second for ISP to fully boot up
// Make sure I2C pins and speed are properly configured before communication
kdrv_pinmux_config(KDRV_PIN_I2C0_SCL, PIN_MODE_0, PIN_PULL_NONE, PIN_DRIVING_8MA);
kdrv_pinmux_config(KDRV_PIN_I2C0_SDA, PIN_MODE_0, PIN_PULL_NONE, PIN_DRIVING_8MA);
kdrv_i2c_initialize(KDRV_I2C_CTRL_0, KDRV_I2C_SPEED_100K);
for (init_fnc_ptr = seq; ; ++init_fnc_ptr)
{
if(init_fnc_ptr->addr == 0 && init_fnc_ptr->value == 0)
break;
imx462_write_reg(dev, init_fnc_ptr->addr , (uint8_t)(init_fnc_ptr->value & 0xFF));
}
// uint32_t data = kdev_sensor_get_dev_id();
// sensor_msg("imx462_init sensor id=%x\n", data);
return 0;
}
static uint32_t imx462_set_params(struct sensor_device *sensor_dev)
{
sensor_msg(" <%s>\n", __func__);
/* initialize the sensor with default settings */
imx462_init(sensor_dev, imx462_init_regs);
return 0;
}
static kdev_status_t kdev_sensor_power(uint32_t on)
{
sensor_msg(" <%s>\n", __func__);
return KDEV_STATUS_OK;
}
static kdev_status_t kdev_sensor_reset()
{
sensor_msg(" <%s>\n", __func__);
return KDEV_STATUS_OK;
}
static kdev_status_t kdev_sensor_stream(uint32_t enable)
{
sensor_msg(" <%s>\n", __func__);
return KDEV_STATUS_OK;
}
static kdev_status_t kdev_sensor_enum_fmt(uint32_t index, uint32_t *code)
{
if (index >= ARRAY_SIZE(imx462_colour_fmts))
return KDEV_STATUS_ERROR;
sensor_msg(" <%s>\n", __func__);
*code = imx462_colour_fmts[index].fourcc;
return KDEV_STATUS_OK;
}
static kdev_status_t kdev_sensor_get_fmt(struct cam_format *format)
{
sensor_msg(" <%s>\n", __func__);
return KDEV_STATUS_OK;
}
static kdev_status_t kdev_sensor_set_fmt(struct cam_format *fmt)
{
sensor_msg(" <%s>\n", __func__);
return (kdev_status_t)imx462_set_params(&imx462_dev);
}
static kdev_status_t kdev_sensor_set_aec(struct cam_sensor_aec *aec_p)
{
sensor_msg(" <%s>\n", __func__);
// Implement AEC ROI setting if needed
return KDEV_STATUS_OK;
}
static kdev_status_t kdev_sensor_get_lux(uint16_t *expo, uint8_t *pre_gain, uint8_t *post_gain, uint8_t* global_gain, uint8_t* y_average)
{
sensor_msg(" <%s>\n", __func__);
// Implement Lux reading if needed
*expo = 0;
*pre_gain = 0;
*post_gain = 0;
*global_gain = 0;
*y_average = 0;
return KDEV_STATUS_OK;
}
static uint32_t kdev_sensor_get_dev_id(void)
{
uint8_t board_model = 0;
uint8_t device_id = 0;
uint8_t hdver = 0;
imx462_read_reg(&imx462_dev, 0x01, &device_id);
imx462_read_reg(&imx462_dev, 0x00, &hdver);
imx462_read_reg(&imx462_dev, 0x25, &board_model);
sensor_msg("VEYE ISP Info -> Board: 0x%02X, Dev ID: 0x%02X, HW Ver: 0x%02X\n", board_model, device_id, hdver);
return device_id;
}
static struct sensor_ops imx462_ops = {
.s_power = kdev_sensor_power,
.reset = kdev_sensor_reset,
.s_stream = kdev_sensor_stream,
.enum_fmt = kdev_sensor_enum_fmt,
.get_fmt = kdev_sensor_get_fmt,
.set_fmt = kdev_sensor_set_fmt,
.set_gain = NULL,
.set_aec = kdev_sensor_set_aec,
.set_exp_time = NULL,
.get_lux = kdev_sensor_get_lux,
.led_switch = NULL,
.set_mirror = NULL,
.set_flip = NULL,
.get_dev_id = kdev_sensor_get_dev_id,
};
struct sensor_ops* kdev_sensor_imx462_get_ops(void)
{
return &imx462_ops;
}

View File

@ -0,0 +1,612 @@
//#define ENABLE_DBG_LOG
#include <string.h>
#include "cmsis_os2.h"
#include "kmdw_power_manager.h"
#include "kmdw_console.h"
#include "kmdw_memory.h"
#include "kdrv_gdma.h"
#include "kdrv_power.h"
#include "kdrv_scu_ext.h"
#include "kdp_system.h"
#include "usbd_hal.h"
#include "model_type.h"
#include "buffer_object.h"
#include "kmdw_fifoq_manager.h"
#include "kdp2_ipc_cmd.h"
#include "kdp2_inf_app_yolo.h"
#include "kdp2_usb_companion.h"
#include "kmdw_display.h"
// --- hico mipi include ---
#include "hico_mipi.h"
#include "kmdw_camera.h"
#include "kdrv_timer.h"
#include "kdrv_i2c.h"
#include "project.h"
extern uint32_t kdrv_efuse_get_kn_number(void);
#define NUM_MIPI_INIT_BUFS 2 // 2 (ping-pong buffers) or 3 (triple-buffers for skipping frames)
/* For 1920x1080, buffer size needs to be larger.
* YUYV (2 bytes/pixel): 1920 * 1080 * 2 = 4,147,200 bytes (~4MB). Let's use 5MB for safety.
* The number of buffers is reduced from 10 to 4 to avoid exhausting the 64MB DDR.
* 4 buffers * 5MB/buffer = 20MB.
*/
#define NUM_IMAGE_BUF 4
#define IMAGE_BUF_SIZE (5 * 1024 * 1024)
#define NUM_RESULT_BUF 4
#define RESULT_BUF_SIZE (400 * 1024)
#if 0//KL720_Scott
#define JTAG_MAGIC_ADDRESS 0x1FFFFFFC
#define JTAG_MAGIC_VALUE 0xFEDCBA01
#define USB_BOOT_MAGIC_HB 0xaabbccdd
#define USB_BOOT_MAGIC_LB 0x11223344
#else
#define JTAG_MAGIC_ADDRESS 0x10100000
#define KDP2_BOOT_CONFIG_ADDRESS 0x10100100
#define JTAG_MAGIC_VALUE 0xFEDCBA01
#define BOOT_FROM_FLASH 0xA
typedef struct
{
uint32_t boot_type; // 0xA = flash-boot, others = usb-boot
uint8_t loader_ver[4]; // fw loader version numbers
uint8_t scpu_fw_ver[4]; // SCPU fw version numbers
uint8_t ncpu_fw_ver[4]; // NCPU fw version numbers
} kdp2_boot_config_t;
#endif
//static osThreadId_t usb_img_tid = 0;
//#define SHOW_SENSOR_IMAGE_ON_LCD//debug purpose: show sensor image directly without inference on LCD
#ifdef ENABLE_DBG_LOG
#define dbg_log(__format__, ...) kmdw_printf("[kp hico mipi]"__format__, ##__VA_ARGS__)
#else
#define dbg_log(__format__, ...)
#endif
typedef struct
{
uint32_t cam_idx;
uint32_t buf_addr;
uint32_t img_width;
uint32_t img_height;
uint32_t img_format;
} mipi_img_object_t;
#define FLAG_WAIT_USB_CONNECTION 0x1
static osThreadId_t _usb_cmd_tid = NULL;
static osMessageQueueId_t _img_queue = NULL;
static uint32_t _hico_mode = MODE_LIVE_VIEW;
//static osThreadId_t task_usb_cmd_handle = NULL;
//static osThreadId_t task_usb_image_handle = NULL;
//static osThreadId_t task_usb_result_handle = NULL;
extern void display_init(uint32_t input_fmt, uint16_t xres, uint16_t yres, uint8_t cam_idx);
extern void display_exit(void);
extern uint32_t lcdc_kdp2_get_disp_idx(int *read_done_idx);
extern uint32_t lcdc_kdp2_set_disp_buf(uint32_t buf_addr, int write_done_idx);
extern uint32_t lcdc_kdp2_get_disp_buf(int cam_idx, int *disp_idx);
static uint32_t _app_job_id = 0xFFFFFFFF;
// usb link status notify
static void usb_user_link_status_callback(usbd_hal_link_status_t link_status)
{
switch (link_status)
{
case USBD_STATUS_DISCONNECTED:
kmdw_printf("USB is disconnected\n");
break;
case USBD_STATUS_CONFIGURED:
kmdw_printf("USB is connected\n");
osThreadFlagsSet(_usb_cmd_tid, FLAG_WAIT_USB_CONNECTION);
break;
}
}
// vendor-specific control transfer setup packet notify
bool usb_user_control_callback(usbd_hal_setup_packet_t *setup)
{
bool ret = false;
dbg_log("control bRequest = 0x%x\n", setup->bRequest);
switch (setup->bRequest)
{
case KDP2_CONTROL_REBOOT:
{
dbg_log("control reboot\n");
kdrv_power_sw_reset();
break;
}
case KDP2_CONTROL_SHUTDOWN:
{
dbg_log("control shutdown\n");
kmdw_power_manager_shutdown();
break;
}
case KDP2_CONTROL_FIFOQ_RESET:
{
dbg_log("control fifoq reset\n");
// FIXME
//kmdw_printf("wakeup USB cmd thread\n");
//osThreadFlagsSet(_usb_cmd_tid, FLAG_WAIT_USB_CONNECTION);
//osThreadFlagsSet(image_thread_id, 0x1);
ret = true;
break;
}
default:
ret = false;
break;
}
return ret;
}
//static cam_format _cams_fmt[2] = {0};
static struct cam_format _cams_fmt[2] = {0};
#include "kdrv_mipicsirx.h"
#include "kdrv_dpi2ahb.h"
void check_mipi_d2a_registers(uint8_t cam_idx)
{
uint32_t csirx_base = (cam_idx == 0) ? CSIRX_FTCSIRX100_PA_BASE : CSIRX_FTCSIRX100_1_PA_BASE;
uint32_t d2a_base = (cam_idx == 0) ? DPI2AHB_CSR_PA_BASE : DPI2AHB_CSR_1_PA_BASE;
uint32_t hpnr = inw(csirx_base + 0x20); // 讀取 HPNR
uint32_t dpisr = inw(csirx_base + 0x38); // 讀取 DPISR
kmdw_printf("\n--- Cam %d MIPI/D2A Register Dump ---\n", cam_idx);
kmdw_printf("[CSIRX] HPNR (Horiz Pixels)= %d (Expected: %d)\n", hpnr, _cams_fmt[cam_idx].width);
kmdw_printf("[CSIRX] MCR (Data Type) = 0x%08X (Expected: 0x00000000)\n", inw(csirx_base + 0x1C));
kmdw_printf("[CSIRX] DPISR(DPI Status) = 0x%08X (PNE:%d, DDE:%d)\n", dpisr, (dpisr >> 5) & 1, (dpisr >> 4) & 1);
kmdw_printf("[CSIRX] PFTR (PHY Settle)= 0x%08X (Expected: 0x00000000 or 0xF5)\n", inw(csirx_base + 0x50));
kmdw_printf("[CSIRX] PECR (Lane En) = 0x%08X (Expected: 0x00000003 for 2 lanes)\n", inw(csirx_base + 0x28));
kmdw_printf("[D2A] CTRL (Control) = 0x%08X (Expected: 0x00003008 or 0x3000)\n", inw(d2a_base + 0x00));
kmdw_printf("[D2A] PT (Packet Type)= 0x%08X (Expected: 0x0000001E for YUV422)\n", inw(d2a_base + 0x1C));
kmdw_printf("[D2A] P0A (Page0 Addr) = 0x%08X\n", inw(d2a_base + 0x08));
kmdw_printf("[D2A] P1A (Page1 Addr) = 0x%08X\n", inw(d2a_base + 0x0C));
kmdw_printf("--------------------------------------\n\n");
}
// image ISR callback
void image_coming_callback(uint32_t cam_idx, uint32_t img_buf, uint32_t *p_new_img)
{
osStatus_t sts;
mipi_img_object_t img_obj;
uint32_t new_inf_buf;
int buf_size;
sts = kmdw_fifoq_manager_image_get_free_buffer(&new_inf_buf, &buf_size, 0, true);
if (sts != osOK)
{
sts = osMessageQueueGet(_img_queue, (void *)&img_obj, NULL, 0);
if (sts != osOK)
{
dbg_log("(ISR) error !! retrieving new buf failed, osMessageQueueGet() ret = %d\n", sts);
// Due to highest priority ISR has,
// image input is so fast that fifoq can't provide a free buffer even force_grab is set
*p_new_img = img_buf;
return;
}
new_inf_buf = img_obj.buf_addr;
}
// get inf_buf address by shift back by the size of XXX_inference_header_t
uint32_t inf_buf = img_buf - sizeof(kdp2_ipc_app_yolo_inf_header_t);
img_obj.cam_idx = cam_idx;
img_obj.buf_addr = inf_buf;
img_obj.img_width = _cams_fmt[cam_idx].width;
img_obj.img_height = _cams_fmt[cam_idx].height;
if (_cams_fmt[cam_idx].pixelformat == IMG_FORMAT_RGB565)
img_obj.img_format = KP_IMAGE_FORMAT_RGB565;
else if (_cams_fmt[cam_idx].pixelformat == IMG_FORMAT_RAW8)
img_obj.img_format = KP_IMAGE_FORMAT_RAW8;
else if (_cams_fmt[cam_idx].pixelformat == IMG_FORMAT_YCBCR)
img_obj.img_format = KP_IMAGE_FORMAT_YUYV;
#ifdef SHOW_SENSOR_IMAGE_ON_LCD
if(cam_idx == 0)
lcdc_kdp2_set_disp_buf(img_buf,0);//show sensor image directly
//DSG("image_coming_callback, img_buf=0x%x, cam_idx=%d, pixelformat=0x%x, img_width=%d img_height=%d",img_buf, cam_idx, _cams_fmt[cam_idx].pixelformat, _cams_fmt[cam_idx].width, _cams_fmt[cam_idx].height);
#endif
sts = osMessageQueuePut(_img_queue, (const void *)&img_obj, 0U, 0);
if (sts != osOK)
{
dbg_log("(ISR) error !! osMessageQueuePut() failed, sts = %d\n", sts);
*p_new_img = img_buf;
return;
}
*p_new_img = new_inf_buf + sizeof(kdp2_ipc_app_yolo_inf_header_t);
return;
}
uint32_t camera_start(uint8_t cam_idx, uint32_t width, uint32_t height, uint32_t pixelformat)
{
uint32_t ret;
struct cam_capability cap;
_cams_fmt[cam_idx].width = width;
_cams_fmt[cam_idx].height = height;
_cams_fmt[cam_idx].pixelformat = pixelformat;
char fmtstr[8];
memset(&cap, 0, sizeof(cap));
if (0 != (ret = kmdw_camera_open(cam_idx)))
return ret;
if (0 != (ret = kmdw_camera_get_device_info(cam_idx, &cap)))
return ret;
if (0 != (ret = kmdw_camera_set_frame_format(cam_idx, &_cams_fmt[cam_idx])))//scpu: exception: code=1, object_id=0x102021d4
return ret;
if (0 != (ret = kmdw_camera_get_frame_format(cam_idx, &_cams_fmt[cam_idx])))
return ret;
memset(fmtstr, 0, 8);
memcpy(fmtstr, &_cams_fmt[cam_idx].pixelformat, 4);
int buf_size;
uint32_t buf_addr[NUM_MIPI_INIT_BUFS] = {0};
// mipi needs some buffers at initialization
for (int i = 0; i < NUM_MIPI_INIT_BUFS; i++)
{
kmdw_fifoq_manager_image_get_free_buffer(&buf_addr[i], &buf_size, osWaitForever, false);
buf_addr[i] += sizeof(kdp2_ipc_app_yolo_inf_header_t);
}
if (0 != (ret = kmdw_camera_buffer_init(cam_idx, buf_addr[0], buf_addr[1])))
return ret;
if (0 != (ret = kmdw_camera_start(cam_idx, image_coming_callback)))
return ret;
// Dump registers after initialization to verify hardware state
//check_mipi_d2a_registers(cam_idx);
return 0;
}
#define CMD_BUF_SIZE (1 * 1024)
//#define CMD_BUF_SIZE (1 * 1024 * 1024)
// this thread receive the command from host SW
void kdp2_hico_mipi_usb_cmd_thread(void *arg)
{
kmdw_printf("[%s] start !\n", __FUNCTION__);
_usb_cmd_tid = osThreadGetId();
if (_usb_cmd_tid == NULL)
kmdw_printf("%s creation failed !\n", __FUNCTION__);
// wait until usb connection is established
osThreadFlagsWait(FLAG_WAIT_USB_CONNECTION, osFlagsWaitAny, osWaitForever);
kmdw_printf("[%s] FLAG_WAIT_USB_CONNECTION OK !\n", __FUNCTION__);
uint32_t cmd_buf = kmdw_ddr_reserve(CMD_BUF_SIZE);
while (1)
{
uint32_t txLen = CMD_BUF_SIZE;
kdrv_status_t usb_sts = usbd_hal_bulk_receive(KDP2_USB_ENDPOINT_DATA_OUT, (void *)cmd_buf, &txLen, osWaitForever);
if (usb_sts != KDRV_STATUS_OK) // KDRV_STATUS_USBD_TRANSFER_TERMINATED or KDRV_STATUS_USBD_TRANSFER_DISCONNECTED
{
dbg_log("[%s] bulk receive is terminated, sts %d\n", __FUNCTION__, usb_sts);
continue;
}
dbg_log("[%s] usb recv addr 0x%x len %d\n", __FUNCTION__, (void *)cmd_buf, txLen);
kp_inference_header_stamp_t *header_stamp = (kp_inference_header_stamp_t *)cmd_buf;
if (header_stamp->magic_type == KDP2_MAGIC_TYPE_COMMAND) // standard KDP2 commands
{
// borrow image fifo to handle KDP2 commands as well
dbg_log("[%s] handle kdp2 command = 0x%x\n", __FUNCTION__, header_stamp->job_id);
// handle kdp2 commands ...
kdp2_cmd_handle_kp_command(cmd_buf);
continue;
}
else if (header_stamp->magic_type == KDP2_MAGIC_TYPE_CUSTOMIZED) // customized commands
{
// customized command to configure mipi camera
if (header_stamp->job_id == JID_START_HICO_MIPI)
{
dbg_log("[%s] configuration command received\n", __FUNCTION__);
hico_mipi_config_command_t *hico_mipi_cmd = (hico_mipi_config_command_t *)cmd_buf;
hico_mipi_config_response_t hico_mipi_resp;
hico_mipi_resp.header_stamp.magic_type = KDP2_MAGIC_TYPE_CUSTOMIZED;
hico_mipi_resp.header_stamp.job_id = JID_START_HICO_MIPI;
hico_mipi_resp.header_stamp.status_code = KP_SUCCESS;
hico_mipi_resp.header_stamp.total_size = sizeof(hico_mipi_resp);
hico_mipi_resp.num_cam_sensors = 0;
_hico_mode = hico_mipi_cmd->mode;
_app_job_id = hico_mipi_cmd->app_job_id;
// Configure the mipi camera
if (hico_mipi_cmd->sensor_sel & CAM_SENSOR_0)
{
if (0 == camera_start(0, IMGSRC_0_WIDTH, IMGSRC_0_HEIGHT, IMGSRC_0_FORMAT))
{
dbg_log("[%s] camera_start 0, ok\n",__FUNCTION__);
hico_mipi_resp.num_cam_sensors++;
hico_mipi_resp.cam_settings[0].img_width = IMGSRC_0_WIDTH;
hico_mipi_resp.cam_settings[0].img_height = IMGSRC_0_HEIGHT;
#if (IMGSRC_0_FORMAT == IMG_FORMAT_YCBCR)
hico_mipi_resp.cam_settings[0].img_format = KP_IMAGE_FORMAT_YUYV;
#else
hico_mipi_resp.cam_settings[0].img_format = KP_IMAGE_FORMAT_RGB565;
#endif
}
else
{
hico_mipi_resp.header_stamp.status_code = KP_ERROR_OTHER_99; // FIXME, give it a specific error code
}
}
if (hico_mipi_cmd->sensor_sel & CAM_SENSOR_1)
{
dbg_log("[%s] camera_start 1, ok\n",__FUNCTION__);
if (0 == camera_start(1, IMGSRC_1_WIDTH, IMGSRC_1_HEIGHT, IMGSRC_1_FORMAT))
{
hico_mipi_resp.num_cam_sensors++;
hico_mipi_resp.cam_settings[1].img_width = IMGSRC_1_WIDTH;
hico_mipi_resp.cam_settings[1].img_height = IMGSRC_1_HEIGHT;
hico_mipi_resp.cam_settings[1].img_format = KP_IMAGE_FORMAT_RAW8;
}
else
{
hico_mipi_resp.header_stamp.status_code = KP_ERROR_OTHER_99; // FIXME, give it a specific error code
}
}
kdrv_status_t usb_sts = usbd_hal_bulk_send(KDP2_USB_ENDPOINT_DATA_IN, (void *)&hico_mipi_resp, sizeof(hico_mipi_resp), 1000);
if (usb_sts != KDRV_STATUS_OK) // KDRV_STATUS_USBD_TRANSFER_TERMINATED or KDRV_STATUS_USBD_TRANSFER_DISCONNECTED
{
dbg_log("error ! usbd_hal_bulk_send() ret = %d\n", usb_sts);
//return;
}
}
else
{
dbg_log("error !!! wrong job_id = %d\n", __FUNCTION__, header_stamp->job_id);
}
}
else if ((header_stamp->magic_type & 0xFFFF) == KDP_MSG_HDR_CMD) // very speical case for old arch. fw update
{
// handle legendary kdp commands, should be as few as possible
dbg_log("[%s] handle legendary kdp command = 0x%x\n",__FUNCTION__, header_stamp->job_id);
kdp2_cmd_handle_legend_kdp_command(cmd_buf);
}
else
{
dbg_log("[%s] error ! buffer begin with incorrect magic_type 0x%x, txLen %d\n", __FUNCTION__, header_stamp->magic_type, txLen);
}
}
}
// this thread sends inference result to host
void kdp2_hico_mipi_usb_result_thread(void *arg)
{
kmdw_printf("[%s] start !\n", __FUNCTION__);
while (1)
{
uint32_t result_buf_addr;
int result_buf_length;
// get result data from result fifo queue with blocking wait
kmdw_fifoq_manager_result_dequeue(&result_buf_addr, &result_buf_length, osWaitForever);
dbg_log("[%s] result_buf_addr=0x%x, result_buf_length=%d\n", __FUNCTION__, result_buf_addr,result_buf_length);
// then send inference result
kdp2_ipc_app_yolo_result_t *yolo_result = (kdp2_ipc_app_yolo_result_t *)result_buf_addr;
yolo_result->header_stamp.job_id = JID_CAM_0_INF_RESULT + yolo_result->inf_number; // for now it tells host SW that this is an inference result
#if 1
//yolo_result->header_stamp.total_size = result_buf_length;
#endif
// send result to the host SW, blocking wait
dbg_log("[%s] send usb data size %d\n", __FUNCTION__, yolo_result->header_stamp.total_size);
kdrv_status_t usb_sts = usbd_hal_bulk_send(KDP2_USB_ENDPOINT_DATA_IN, (void *)result_buf_addr, yolo_result->header_stamp.total_size, osWaitForever);
if (usb_sts != KDRV_STATUS_OK) // KDRV_STATUS_USBD_TRANSFER_TERMINATED or KDRV_STATUS_USBD_TRANSFER_DISCONNECTED
{
dbg_log("error ! usbd_hal_bulk_send() ret = %d \n", usb_sts);
}
// return free buf back to queue
kmdw_fifoq_manager_result_put_free_buffer(result_buf_addr, result_buf_length, osWaitForever);
}
}
// this thread sends raw image from image sensor to host SW (and also enqueues it to image fifo queue ?)
void kdp2_hico_mipi_usb_img_send_back_thread(void *arg)
{
kmdw_printf("[%s] start !\n", __FUNCTION__);
while (1)
{
mipi_img_object_t img_obj;
osMessageQueueGet(_img_queue, (void *)&img_obj, NULL, osWaitForever);
dbg_log("[%s] _hico_mode = %d\n",__FUNCTION__, _hico_mode);
dbg_log("[%s] got inf-buf (cam_idx %d buf_addr 0x%p img_width %d img_height %d img_format %d)\n",
__FUNCTION__,img_obj.cam_idx, img_obj.buf_addr, img_obj.img_width, img_obj.img_height, img_obj.img_format);
kdp2_ipc_app_yolo_inf_header_t *inf_header = (kdp2_ipc_app_yolo_inf_header_t *)img_obj.buf_addr;
int byte_ppix;
switch (img_obj.img_format)
{
case KP_IMAGE_FORMAT_RGB565:
case KP_IMAGE_FORMAT_YUYV:
byte_ppix = 2;
break;
case KP_IMAGE_FORMAT_RGBA8888:
byte_ppix = 3;
break;
case KP_IMAGE_FORMAT_RAW8:
byte_ppix = 1;
}
inf_header->header_stamp.magic_type = KDP2_MAGIC_TYPE_INFERENCE;
inf_header->header_stamp.total_size = sizeof(kdp2_ipc_app_yolo_inf_header_t) + (img_obj.img_width * img_obj.img_height * byte_ppix);
inf_header->header_stamp.job_id = JID_CAM_0_IMAGE + img_obj.cam_idx;
inf_header->header_stamp.status_code = KP_SUCCESS;
inf_header->inf_number = img_obj.cam_idx;
inf_header->width = img_obj.img_width;
inf_header->height = img_obj.img_height;
inf_header->channel = (img_obj.img_format == KP_IMAGE_FORMAT_RAW8) ? 1 : 3;
#if 0//KL720_Scott
inf_header->model_id = KNERON_YOLOV5S_COCO80_640_640_3;//
#else
inf_header->model_id = TINY_YOLO_V3_224_224_3;
#endif
inf_header->image_format = img_obj.img_format;
inf_header->model_normalize = KP_NORMALIZE_KNERON;
dbg_log("[%s] send usb data size %d\n", __FUNCTION__, inf_header->header_stamp.total_size);
kdrv_status_t usb_sts = usbd_hal_bulk_send(KDP2_USB_ENDPOINT_DATA_IN, (void *)inf_header, inf_header->header_stamp.total_size, osWaitForever);
if (usb_sts != KDRV_STATUS_OK) // KDRV_STATUS_USBD_TRANSFER_TERMINATED or KDRV_STATUS_USBD_TRANSFER_DISCONNECTED
{
dbg_log("error ! usbd_hal_bulk_send() ret = %d\n", usb_sts);
return;
}
if (_hico_mode == MODE_LIVE_VIEW)
{
dbg_log("[%s] kmdw_fifoq_manager_image_put_free_buffer %d\n",__FUNCTION__);
kmdw_fifoq_manager_image_put_free_buffer((uint32_t)inf_header, IMAGE_BUF_SIZE, osWaitForever);
}
else // MODE_LIVE_VIEW_INF
{
dbg_log("[%s] kmdw_fifoq_manager_image_enqueue %d\n",__FUNCTION__);
inf_header->header_stamp.job_id = _app_job_id;
kmdw_fifoq_manager_image_enqueue(1, 0, (uint32_t)inf_header, IMAGE_BUF_SIZE, osWaitForever, false);
}
}
}
////////////////////////////////////////////////////////////
#define RECOVERY_MARK_POS (SdRAM_MEM_BASE + SdRAM_MEM_SIZE - 64)
// KDP2 Inference Interface for HICO MIPI code
// image input
// image + inference output
int kdp2_hico_mipi_init()
{
// retrieve real serial number here from efuse
// then convert it to hex string format
uint32_t uid = 0;
uid = kdp_sys_get_kn_number();
int32_t sidx = 0;
uint8_t kn_num_string[32] = {0};
for (int i = 7; i >= 0; i--)
{
uint32_t hex = (uid >> i * 4) & 0xF;
kn_num_string[sidx] = (hex < 10) ? '0' + hex : 'A' + (hex - 10);
sidx += 2;
}
// HICO Mode
uint16_t bcdDevice = KP_KDP2_FW_HICO_MODE;
if (*((uint32_t *)JTAG_MAGIC_ADDRESS) == JTAG_MAGIC_VALUE)
{
kmdw_printf("FW is running in JTAG mode\n");
bcdDevice |= KP_KDP2_FW_JTAG_TYPE;
}
else
{
kdp2_boot_config_t *bConfig = (kdp2_boot_config_t *)KDP2_BOOT_CONFIG_ADDRESS;
if (bConfig->boot_type == BOOT_FROM_FLASH)
{
kmdw_printf("KDP2 FW is running in flash-boot mode\n");
bcdDevice |= KP_KDP2_FW_FLASH_TYPE;
kmdw_printf("boot ncpu fw from flash\n");
SCU_EXTREG_CM4_NCPU_CTRL_SET_wakeup(1); // run ncpu
}
else
{
kmdw_printf("KDP2 FW is running in usb-boot mode\n");
bcdDevice |= KP_KDP2_FW_USB_TYPE;
}
}
// this is about recovery mode
*(uint32_t *)RECOVERY_MARK_POS = 0;
usbd_hal_initialize(kn_num_string, bcdDevice, usb_user_link_status_callback, usb_user_control_callback);
usbd_hal_set_enable(true);
/* Allocate memory for image and result buffers */
uint32_t buf_addr = kmdw_ddr_reserve(NUM_IMAGE_BUF * IMAGE_BUF_SIZE + NUM_RESULT_BUF * RESULT_BUF_SIZE);
if (buf_addr == 0)
{
dbg_log("error !!! kmdw_ddr_reserve() failed for image/result buffers\n");
return -1;
}
// queue buffers into image free-queue
for (uint32_t i = 0; i < NUM_IMAGE_BUF; i++)
{
kmdw_fifoq_manager_image_put_free_buffer(buf_addr, IMAGE_BUF_SIZE, osWaitForever);
buf_addr += IMAGE_BUF_SIZE;
}
// queue buffers into result free-queue
for (uint32_t i = 0; i < NUM_RESULT_BUF; i++)
{
kmdw_fifoq_manager_result_put_free_buffer(buf_addr, RESULT_BUF_SIZE, osWaitForever);
buf_addr += RESULT_BUF_SIZE;
}
// prepare an internal image queue between ISR callback and image-processing thread
_img_queue = osMessageQueueNew(NUM_IMAGE_BUF, sizeof(mipi_img_object_t), NULL);
if (_img_queue == NULL)
{
dbg_log("error !!! osMessageQueueNew() failed\n");
}
kmdw_fifoq_manager_store_fifoq_config(NUM_IMAGE_BUF, IMAGE_BUF_SIZE, NUM_RESULT_BUF, RESULT_BUF_SIZE);
// wow ! fifoq can also handle command
kdp2_cmd_handler_initialize();
#ifdef SHOW_SENSOR_IMAGE_ON_LCD
display_init(V2K_PIX_FMT_RGB565, IMGSRC_0_WIDTH, IMGSRC_0_HEIGHT, 0);
#endif
return 0;
}

View File

@ -0,0 +1,57 @@
/*
* Kneron Main Entry driver
*
* Copyright (C) 2020 Kneron, Inc. All rights reserved.
*
*/
#include <stdio.h>
#include "cmsis_os2.h" // ARM::CMSIS:RTOS2:Keil RTX5
#include "project.h"
#include "version.h"
// Customized configuration and implementation
#include "system_init.h"
#include "driver_init.h"
#include "device_init.h"
#include "middleware_init.h"
#include "application_init.h"
#include "kmdw_console.h"
extern void task_initialize(void);
/**
* @brief main, main function
*/
int main(void)
{
osKernelInitialize(); // Initialize CMSIS-RTOS
sys_initialize();
drv_initialize(); /* customize driver initialization, see driver_init.c */
dev_initialize(); /* customize device initialization, see device_init.c */
mdw_initialize(); /* customize middleware initialization, see middlewre_init.c */
printf("SDK v%u.%u.%u-:build.%03u\n",
(uint8_t)(IMG_FW_MAJOR),
(uint8_t)(IMG_FW_MINOR),
(uint8_t)(IMG_FW_UPDATE),
(uint32_t)(IMG_FW_BUILD));
app_initialize(); /* customize application initialization, see application_init.c */
/* New task threads */
task_initialize();
/* Start RTOS Kernel */
if (osKernelGetState() == osKernelReady)
{
osKernelStart();
}
while (1)
{
}
}

View File

@ -0,0 +1,34 @@
/********************************************************************
* Copyright (c) 2020 Kneron, Inc. All Rights Reserved.
*
* The information contained herein is property of Kneron, Inc.
* Terms and conditions of usage are described in detail in Kneron
* STANDARD SOFTWARE LICENSE AGREEMENT.
*
* Licensees are granted free, non-transferable use of the information.
* NO WARRANTY of ANY KIND is provided. This heading must NOT be removed
* from the file.
********************************************************************/
#include "project.h"
#include "kmdw_memory.h"
#include "kmdw_model.h"
#include "kmdw_dfu.h"
#include "kmdw_camera.h"
#include "kmdw_display.h"
#include "kmdw_console.h"
void mdw_initialize(void)
{
kmdw_ddr_init(DDR_HEAP_BEGIN, DDR_HEAP_END);
kmdw_ddr_store_system_reserve(DDR_SYSTEM_RESERVED_BEGIN, DDR_SYSTEM_RESERVED_END);
kmdw_uart_console_init(MSG_PORT, MSG_PORT_BAUDRATE); // uart console
kmdw_dfu_init(NULL, NULL);
kmdw_model_init();
//load_ncpu_fw(1/*reset_flag*/); // (kmdw_system.h) load ncpu fw from flash
kmdw_camera_init(); // init cameras
kmdw_display_initialize(); // init display
}

View File

@ -0,0 +1,23 @@
/********************************************************************
* Copyright (c) 2020 Kneron, Inc. All Rights Reserved.
*
* The information contained herein is property of Kneron, Inc.
* Terms and conditions of usage are described in detail in Kneron
* STANDARD SOFTWARE LICENSE AGREEMENT.
*
* Licensees are granted free, non-transferable use of the information.
* NO WARRANTY of ANY KIND is provided. This heading must NOT be removed
* from the file.
********************************************************************/
//Include
//#include "project.h"
#include "kdrv_system.h"
//Function
void sys_initialize(void)
{
/* SDK main init for companion mode */
kdrv_system_init();
kdrv_system_init_ncpu();
}

View File

@ -0,0 +1,19 @@
#!armcc -E
#define DRAM_START 0x0FFF0000
#define DRAM_SIZE 0x00010000
LR_IROM1 0x00000000 0x00010000 { ; load region size_region
ER_IROM1 0x00000000 0x00010000 { ; load address = execution address
*.o (RESET, +First)
*(InRoot$$Sections)
.ANY (+RO)
}
RW_IRAM1 DRAM_START DRAM_SIZE-8 { ; RW data
.ANY (+RW +ZI)
}
RW_IRAM2 AlignExpr(+0,8) {
.ANY (misc_data)
}
}

View File

@ -0,0 +1,552 @@
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<ProjectOpt xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="project_optx.xsd">
<SchemaVersion>1.0</SchemaVersion>
<Header>### uVision Project, (C) Keil Software</Header>
<Extensions>
<cExt>*.c</cExt>
<aExt>*.s*; *.src; *.a*</aExt>
<oExt>*.obj; *.o</oExt>
<lExt>*.lib</lExt>
<tExt>*.txt; *.h; *.inc; *.md</tExt>
<pExt>*.plm</pExt>
<CppX>*.cpp</CppX>
<nMigrate>0</nMigrate>
</Extensions>
<DaveTm>
<dwLowDateTime>0</dwLowDateTime>
<dwHighDateTime>0</dwHighDateTime>
</DaveTm>
<Target>
<TargetName>ncpu</TargetName>
<ToolsetNumber>0x4</ToolsetNumber>
<ToolsetName>ARM-ADS</ToolsetName>
<TargetOption>
<CLKADS>250000000</CLKADS>
<OPTTT>
<gFlags>1</gFlags>
<BeepAtEnd>1</BeepAtEnd>
<RunSim>0</RunSim>
<RunTarget>1</RunTarget>
<RunAbUc>0</RunAbUc>
</OPTTT>
<OPTHX>
<HexSelection>1</HexSelection>
<FlashByte>65535</FlashByte>
<HexRangeLowAddress>0</HexRangeLowAddress>
<HexRangeHighAddress>0</HexRangeHighAddress>
<HexOffset>0</HexOffset>
</OPTHX>
<OPTLEX>
<PageWidth>79</PageWidth>
<PageLength>66</PageLength>
<TabStop>8</TabStop>
<ListingPath>.\Listings\</ListingPath>
</OPTLEX>
<ListingPage>
<CreateCListing>1</CreateCListing>
<CreateAListing>1</CreateAListing>
<CreateLListing>1</CreateLListing>
<CreateIListing>0</CreateIListing>
<AsmCond>1</AsmCond>
<AsmSymb>1</AsmSymb>
<AsmXref>0</AsmXref>
<CCond>1</CCond>
<CCode>0</CCode>
<CListInc>0</CListInc>
<CSymb>0</CSymb>
<LinkerCodeListing>0</LinkerCodeListing>
</ListingPage>
<OPTXL>
<LMap>1</LMap>
<LComments>1</LComments>
<LGenerateSymbols>1</LGenerateSymbols>
<LLibSym>1</LLibSym>
<LLines>1</LLines>
<LLocSym>1</LLocSym>
<LPubSym>1</LPubSym>
<LXref>0</LXref>
<LExpSel>0</LExpSel>
</OPTXL>
<OPTFL>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<IsCurrentTarget>1</IsCurrentTarget>
</OPTFL>
<CpuCode>7</CpuCode>
<DebugOpt>
<uSim>0</uSim>
<uTrg>1</uTrg>
<sLdApp>1</sLdApp>
<sGomain>1</sGomain>
<sRbreak>1</sRbreak>
<sRwatch>1</sRwatch>
<sRmem>1</sRmem>
<sRfunc>1</sRfunc>
<sRbox>1</sRbox>
<tLdApp>1</tLdApp>
<tGomain>0</tGomain>
<tRbreak>1</tRbreak>
<tRwatch>1</tRwatch>
<tRmem>1</tRmem>
<tRfunc>0</tRfunc>
<tRbox>1</tRbox>
<tRtrace>1</tRtrace>
<sRSysVw>1</sRSysVw>
<tRSysVw>1</tRSysVw>
<sRunDeb>0</sRunDeb>
<sLrtime>0</sLrtime>
<bEvRecOn>1</bEvRecOn>
<bSchkAxf>0</bSchkAxf>
<bTchkAxf>0</bTchkAxf>
<nTsel>4</nTsel>
<sDll></sDll>
<sDllPa></sDllPa>
<sDlgDll></sDlgDll>
<sDlgPa></sDlgPa>
<sIfile></sIfile>
<tDll></tDll>
<tDllPa></tDllPa>
<tDlgDll></tDlgDll>
<tDlgPa></tDlgPa>
<tIfile></tIfile>
<pMon>Segger\JL2CM3.dll</pMon>
</DebugOpt>
<TargetDriverDllRegistry>
<SetRegEntry>
<Number>0</Number>
<Key>DLGUARM</Key>
<Name></Name>
</SetRegEntry>
<SetRegEntry>
<Number>0</Number>
<Key>DLGDARM</Key>
<Name>(1010=-1,-1,-1,-1,0)(1007=-1,-1,-1,-1,0)(1008=-1,-1,-1,-1,0)(1009=-1,-1,-1,-1,0)(1012=-1,-1,-1,-1,0)</Name>
</SetRegEntry>
<SetRegEntry>
<Number>0</Number>
<Key>ULP2CM3</Key>
<Name>-UAny -O905 -S0 -C0 -P00 -N00("ARM CoreSight JTAG-DP") -D00(4BA00477) -L00(4) -N01("ARM CoreSight JTAG-DP") -D01(4BA00477) -L01(4) -TO18 -TC10000000 -TP18 -TDX0 -TDD0 -TDS8000 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -FO3 -FD20000000 -FC1000 -FN0</Name>
</SetRegEntry>
<SetRegEntry>
<Number>0</Number>
<Key>ARMRTXEVENTFLAGS</Key>
<Name>-L70 -Z18 -C0 -M0 -T1</Name>
</SetRegEntry>
<SetRegEntry>
<Number>0</Number>
<Key>DLGTARM</Key>
<Name>(1010=-1,-1,-1,-1,0)(1007=-1,-1,-1,-1,0)(1008=-1,-1,-1,-1,0)(1009=-1,-1,-1,-1,0)(1012=-1,-1,-1,-1,0)</Name>
</SetRegEntry>
<SetRegEntry>
<Number>0</Number>
<Key>ARMDBGFLAGS</Key>
<Name>-T0</Name>
</SetRegEntry>
<SetRegEntry>
<Number>0</Number>
<Key>JL2CM3</Key>
<Name>-U63610859 -O1 -S2 -ZTIFSpeedSel5000 -A0 -C0 -JU1 -JI127.0.0.1 -JP0 -RST1 -N00("ARM CoreSight JTAG-DP") -D00(4BA00477) -L00(4) -N01("ARM CoreSight JTAG-DP") -D01(4BA00477) -L01(4) -TO18 -TC10000000 -TP21 -TDS8007 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -TB1 -TFE0 -FO1 -FD20000000 -FC1000 -FN0</Name>
</SetRegEntry>
<SetRegEntry>
<Number>0</Number>
<Key>UL2CM3</Key>
<Name>UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000)</Name>
</SetRegEntry>
</TargetDriverDllRegistry>
<Breakpoint>
<Bp>
<Number>0</Number>
<Type>0</Type>
<LineNumber>169</LineNumber>
<EnabledFlag>1</EnabledFlag>
<Address>0</Address>
<ByteObject>0</ByteObject>
<HtxType>0</HtxType>
<ManyObjects>0</ManyObjects>
<SizeOfObject>0</SizeOfObject>
<BreakByAccess>0</BreakByAccess>
<BreakIfRCount>0</BreakIfRCount>
<Filename>D:\3_code\mozart_sw_kdp2.git\scpu\project\companion_kdp2\main\main.c</Filename>
<ExecCommand></ExecCommand>
<Expression></Expression>
</Bp>
</Breakpoint>
<MemoryWindow1>
<Mm>
<WinNumber>1</WinNumber>
<SubType>2</SubType>
<ItemText>0x30ff0140</ItemText>
<AccSizeX>0</AccSizeX>
</Mm>
</MemoryWindow1>
<MemoryWindow2>
<Mm>
<WinNumber>2</WinNumber>
<SubType>2</SubType>
<ItemText>0x61000000</ItemText>
<AccSizeX>0</AccSizeX>
</Mm>
</MemoryWindow2>
<MemoryWindow3>
<Mm>
<WinNumber>3</WinNumber>
<SubType>2</SubType>
<ItemText>0xa0000000</ItemText>
<AccSizeX>0</AccSizeX>
</Mm>
</MemoryWindow3>
<MemoryWindow4>
<Mm>
<WinNumber>4</WinNumber>
<SubType>2</SubType>
<ItemText>0</ItemText>
<AccSizeX>0</AccSizeX>
</Mm>
</MemoryWindow4>
<Tracepoint>
<THDelay>0</THDelay>
</Tracepoint>
<DebugFlag>
<trace>0</trace>
<periodic>1</periodic>
<aLwin>0</aLwin>
<aCover>0</aCover>
<aSer1>0</aSer1>
<aSer2>0</aSer2>
<aPa>0</aPa>
<viewmode>1</viewmode>
<vrSel>0</vrSel>
<aSym>0</aSym>
<aTbox>0</aTbox>
<AscS1>0</AscS1>
<AscS2>0</AscS2>
<AscS3>0</AscS3>
<aSer3>0</aSer3>
<eProf>0</eProf>
<aLa>0</aLa>
<aPa1>0</aPa1>
<AscS4>0</AscS4>
<aSer4>0</aSer4>
<StkLoc>0</StkLoc>
<TrcWin>0</TrcWin>
<newCpu>0</newCpu>
<uProt>0</uProt>
</DebugFlag>
<LintExecutable></LintExecutable>
<LintConfigFile></LintConfigFile>
<bLintAuto>0</bLintAuto>
<bAutoGenD>0</bAutoGenD>
<LntExFlags>0</LntExFlags>
<pMisraName></pMisraName>
<pszMrule></pszMrule>
<pSingCmds></pSingCmds>
<pMultCmds></pMultCmds>
<pMisraNamep></pMisraNamep>
<pszMrulep></pszMrulep>
<pSingCmdsp></pSingCmdsp>
<pMultCmdsp></pMultCmdsp>
</TargetOption>
</Target>
<Group>
<GroupName>main</GroupName>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<cbSel>0</cbSel>
<RteFlg>0</RteFlg>
<File>
<GroupNumber>1</GroupNumber>
<FileNumber>1</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>..\..\main_ncpu\main.c</PathWithFileName>
<FilenameWithoutPath>main.c</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
<File>
<GroupNumber>1</GroupNumber>
<FileNumber>2</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>..\..\main_ncpu\model_ftr_table.c</PathWithFileName>
<FilenameWithoutPath>model_ftr_table.c</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
</Group>
<Group>
<GroupName>libs</GroupName>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<cbSel>0</cbSel>
<RteFlg>0</RteFlg>
<File>
<GroupNumber>2</GroupNumber>
<FileNumber>3</FileNumber>
<FileType>4</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>..\..\..\..\lib\kdp2_ncpu_sdk.lib</PathWithFileName>
<FilenameWithoutPath>kdp2_ncpu_sdk.lib</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
<File>
<GroupNumber>2</GroupNumber>
<FileNumber>4</FileNumber>
<FileType>4</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>..\..\..\..\lib\kdp2_ncpu_model_ppp.lib</PathWithFileName>
<FilenameWithoutPath>kdp2_ncpu_model_ppp.lib</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
</Group>
<Group>
<GroupName>rtx</GroupName>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<cbSel>0</cbSel>
<RteFlg>0</RteFlg>
<File>
<GroupNumber>3</GroupNumber>
<FileNumber>5</FileNumber>
<FileType>2</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>..\..\..\..\platform\kl520\ncpu\rtos\rtx\irq_cm4f.s</PathWithFileName>
<FilenameWithoutPath>irq_cm4f.s</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
<File>
<GroupNumber>3</GroupNumber>
<FileNumber>6</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>..\..\..\..\platform\kl520\ncpu\rtos\rtx\os_systick.c</PathWithFileName>
<FilenameWithoutPath>os_systick.c</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
<File>
<GroupNumber>3</GroupNumber>
<FileNumber>7</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>..\..\..\..\platform\kl520\ncpu\rtos\rtx\RTX_Config.c</PathWithFileName>
<FilenameWithoutPath>RTX_Config.c</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
<File>
<GroupNumber>3</GroupNumber>
<FileNumber>8</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>..\..\..\..\platform\kl520\ncpu\rtos\rtx\rtx_delay.c</PathWithFileName>
<FilenameWithoutPath>rtx_delay.c</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
<File>
<GroupNumber>3</GroupNumber>
<FileNumber>9</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>..\..\..\..\platform\kl520\ncpu\rtos\rtx\rtx_evflags.c</PathWithFileName>
<FilenameWithoutPath>rtx_evflags.c</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
<File>
<GroupNumber>3</GroupNumber>
<FileNumber>10</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>..\..\..\..\platform\kl520\ncpu\rtos\rtx\rtx_evr.c</PathWithFileName>
<FilenameWithoutPath>rtx_evr.c</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
<File>
<GroupNumber>3</GroupNumber>
<FileNumber>11</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>..\..\..\..\platform\kl520\ncpu\rtos\rtx\rtx_kernel.c</PathWithFileName>
<FilenameWithoutPath>rtx_kernel.c</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
<File>
<GroupNumber>3</GroupNumber>
<FileNumber>12</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>..\..\..\..\platform\kl520\ncpu\rtos\rtx\rtx_lib.c</PathWithFileName>
<FilenameWithoutPath>rtx_lib.c</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
<File>
<GroupNumber>3</GroupNumber>
<FileNumber>13</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>..\..\..\..\platform\kl520\ncpu\rtos\rtx\rtx_memory.c</PathWithFileName>
<FilenameWithoutPath>rtx_memory.c</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
<File>
<GroupNumber>3</GroupNumber>
<FileNumber>14</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>..\..\..\..\platform\kl520\ncpu\rtos\rtx\rtx_mempool.c</PathWithFileName>
<FilenameWithoutPath>rtx_mempool.c</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
<File>
<GroupNumber>3</GroupNumber>
<FileNumber>15</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>..\..\..\..\platform\kl520\ncpu\rtos\rtx\rtx_msgqueue.c</PathWithFileName>
<FilenameWithoutPath>rtx_msgqueue.c</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
<File>
<GroupNumber>3</GroupNumber>
<FileNumber>16</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>..\..\..\..\platform\kl520\ncpu\rtos\rtx\rtx_mutex.c</PathWithFileName>
<FilenameWithoutPath>rtx_mutex.c</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
<File>
<GroupNumber>3</GroupNumber>
<FileNumber>17</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>..\..\..\..\platform\kl520\ncpu\rtos\rtx\rtx_semaphore.c</PathWithFileName>
<FilenameWithoutPath>rtx_semaphore.c</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
<File>
<GroupNumber>3</GroupNumber>
<FileNumber>18</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>..\..\..\..\platform\kl520\ncpu\rtos\rtx\rtx_system.c</PathWithFileName>
<FilenameWithoutPath>rtx_system.c</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
<File>
<GroupNumber>3</GroupNumber>
<FileNumber>19</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>..\..\..\..\platform\kl520\ncpu\rtos\rtx\rtx_thread.c</PathWithFileName>
<FilenameWithoutPath>rtx_thread.c</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
<File>
<GroupNumber>3</GroupNumber>
<FileNumber>20</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>..\..\..\..\platform\kl520\ncpu\rtos\rtx\rtx_timer.c</PathWithFileName>
<FilenameWithoutPath>rtx_timer.c</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
</Group>
<Group>
<GroupName>startup</GroupName>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<cbSel>0</cbSel>
<RteFlg>0</RteFlg>
<File>
<GroupNumber>4</GroupNumber>
<FileNumber>21</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>..\..\..\..\platform\kl520\ncpu\startup\startup.c</PathWithFileName>
<FilenameWithoutPath>startup.c</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
<File>
<GroupNumber>4</GroupNumber>
<FileNumber>22</FileNumber>
<FileType>2</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>..\..\..\..\platform\kl520\ncpu\startup\startup_asm.s</PathWithFileName>
<FilenameWithoutPath>startup_asm.s</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
</Group>
</ProjectOpt>

View File

@ -0,0 +1,548 @@
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<Project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="project_projx.xsd">
<SchemaVersion>2.1</SchemaVersion>
<Header>### uVision Project, (C) Keil Software</Header>
<Targets>
<Target>
<TargetName>ncpu</TargetName>
<ToolsetNumber>0x4</ToolsetNumber>
<ToolsetName>ARM-ADS</ToolsetName>
<pCCUsed>5060960::V5.06 update 7 (build 960)::.\ARMCC</pCCUsed>
<uAC6>0</uAC6>
<TargetOption>
<TargetCommonOption>
<Device>ARMCM4_FP</Device>
<Vendor>ARM</Vendor>
<PackID>ARM.CMSIS.5.7.0</PackID>
<PackURL>http://www.keil.com/pack/</PackURL>
<Cpu>IRAM(0x20000000,0x00020000) IROM(0x00000000,0x00040000) CPUTYPE("Cortex-M4") FPU2 CLOCK(12000000) ESEL ELITTLE</Cpu>
<FlashUtilSpec></FlashUtilSpec>
<StartupFile></StartupFile>
<FlashDriverDll>UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000)</FlashDriverDll>
<DeviceId>0</DeviceId>
<RegisterFile>$$Device:ARMCM4_FP$Device\ARM\ARMCM4\Include\ARMCM4_FP.h</RegisterFile>
<MemoryEnv></MemoryEnv>
<Cmp></Cmp>
<Asm></Asm>
<Linker></Linker>
<OHString></OHString>
<InfinionOptionDll></InfinionOptionDll>
<SLE66CMisc></SLE66CMisc>
<SLE66AMisc></SLE66AMisc>
<SLE66LinkerMisc></SLE66LinkerMisc>
<SFDFile>$$Device:ARMCM4$Device\ARM\SVD\ARMCM4.svd</SFDFile>
<bCustSvd>0</bCustSvd>
<UseEnv>0</UseEnv>
<BinPath></BinPath>
<IncludePath></IncludePath>
<LibPath></LibPath>
<RegisterFilePath></RegisterFilePath>
<DBRegisterFilePath></DBRegisterFilePath>
<TargetStatus>
<Error>0</Error>
<ExitCodeStop>0</ExitCodeStop>
<ButtonStop>0</ButtonStop>
<NotGenerated>0</NotGenerated>
<InvalidFlash>1</InvalidFlash>
</TargetStatus>
<OutputDirectory>.\Objects\</OutputDirectory>
<OutputName>Mozart_ncpu</OutputName>
<CreateExecutable>1</CreateExecutable>
<CreateLib>0</CreateLib>
<CreateHexFile>0</CreateHexFile>
<DebugInformation>1</DebugInformation>
<BrowseInformation>1</BrowseInformation>
<ListingPath>.\Listings\</ListingPath>
<HexFormatSelection>1</HexFormatSelection>
<Merge32K>0</Merge32K>
<CreateBatchFile>0</CreateBatchFile>
<BeforeCompile>
<RunUserProg1>0</RunUserProg1>
<RunUserProg2>0</RunUserProg2>
<UserProg1Name></UserProg1Name>
<UserProg2Name></UserProg2Name>
<UserProg1Dos16Mode>0</UserProg1Dos16Mode>
<UserProg2Dos16Mode>0</UserProg2Dos16Mode>
<nStopU1X>0</nStopU1X>
<nStopU2X>0</nStopU2X>
</BeforeCompile>
<BeforeMake>
<RunUserProg1>0</RunUserProg1>
<RunUserProg2>0</RunUserProg2>
<UserProg1Name></UserProg1Name>
<UserProg2Name></UserProg2Name>
<UserProg1Dos16Mode>0</UserProg1Dos16Mode>
<UserProg2Dos16Mode>0</UserProg2Dos16Mode>
<nStopB1X>0</nStopB1X>
<nStopB2X>0</nStopB2X>
</BeforeMake>
<AfterMake>
<RunUserProg1>1</RunUserProg1>
<RunUserProg2>1</RunUserProg2>
<UserProg1Name>fromelf.exe --bin "!L" --output ".\Objects\fw_ncpu.bin"</UserProg1Name>
<UserProg2Name>post_build.bat fw_ncpu.bin</UserProg2Name>
<UserProg1Dos16Mode>0</UserProg1Dos16Mode>
<UserProg2Dos16Mode>0</UserProg2Dos16Mode>
<nStopA1X>0</nStopA1X>
<nStopA2X>0</nStopA2X>
</AfterMake>
<SelectedForBatchBuild>1</SelectedForBatchBuild>
<SVCSIdString></SVCSIdString>
</TargetCommonOption>
<CommonProperty>
<UseCPPCompiler>0</UseCPPCompiler>
<RVCTCodeConst>0</RVCTCodeConst>
<RVCTZI>0</RVCTZI>
<RVCTOtherData>0</RVCTOtherData>
<ModuleSelection>0</ModuleSelection>
<IncludeInBuild>1</IncludeInBuild>
<AlwaysBuild>0</AlwaysBuild>
<GenerateAssemblyFile>0</GenerateAssemblyFile>
<AssembleAssemblyFile>0</AssembleAssemblyFile>
<PublicsOnly>0</PublicsOnly>
<StopOnExitCode>3</StopOnExitCode>
<CustomArgument></CustomArgument>
<IncludeLibraryModules></IncludeLibraryModules>
<ComprImg>1</ComprImg>
</CommonProperty>
<DllOption>
<SimDllName>SARMCM3.DLL</SimDllName>
<SimDllArguments> -MPU</SimDllArguments>
<SimDlgDll>DCM.DLL</SimDlgDll>
<SimDlgDllArguments>-pCM4</SimDlgDllArguments>
<TargetDllName>SARMCM3.DLL</TargetDllName>
<TargetDllArguments> -MPU</TargetDllArguments>
<TargetDlgDll>TCM.DLL</TargetDlgDll>
<TargetDlgDllArguments>-pCM4</TargetDlgDllArguments>
</DllOption>
<DebugOption>
<OPTHX>
<HexSelection>1</HexSelection>
<HexRangeLowAddress>0</HexRangeLowAddress>
<HexRangeHighAddress>0</HexRangeHighAddress>
<HexOffset>0</HexOffset>
<Oh166RecLen>16</Oh166RecLen>
</OPTHX>
</DebugOption>
<Utilities>
<Flash1>
<UseTargetDll>1</UseTargetDll>
<UseExternalTool>0</UseExternalTool>
<RunIndependent>0</RunIndependent>
<UpdateFlashBeforeDebugging>1</UpdateFlashBeforeDebugging>
<Capability>1</Capability>
<DriverSelection>4096</DriverSelection>
</Flash1>
<bUseTDR>1</bUseTDR>
<Flash2>BIN\UL2CM3.DLL</Flash2>
<Flash3>"" ()</Flash3>
<Flash4></Flash4>
<pFcarmOut></pFcarmOut>
<pFcarmGrp></pFcarmGrp>
<pFcArmRoot></pFcArmRoot>
<FcArmLst>0</FcArmLst>
</Utilities>
<TargetArmAds>
<ArmAdsMisc>
<GenerateListings>0</GenerateListings>
<asHll>1</asHll>
<asAsm>1</asAsm>
<asMacX>1</asMacX>
<asSyms>1</asSyms>
<asFals>1</asFals>
<asDbgD>1</asDbgD>
<asForm>1</asForm>
<ldLst>0</ldLst>
<ldmm>1</ldmm>
<ldXref>1</ldXref>
<BigEnd>0</BigEnd>
<AdsALst>1</AdsALst>
<AdsACrf>1</AdsACrf>
<AdsANop>0</AdsANop>
<AdsANot>0</AdsANot>
<AdsLLst>1</AdsLLst>
<AdsLmap>1</AdsLmap>
<AdsLcgr>1</AdsLcgr>
<AdsLsym>1</AdsLsym>
<AdsLszi>1</AdsLszi>
<AdsLtoi>1</AdsLtoi>
<AdsLsun>1</AdsLsun>
<AdsLven>1</AdsLven>
<AdsLsxf>1</AdsLsxf>
<RvctClst>1</RvctClst>
<GenPPlst>0</GenPPlst>
<AdsCpuType>"Cortex-M4"</AdsCpuType>
<RvctDeviceName></RvctDeviceName>
<mOS>0</mOS>
<uocRom>0</uocRom>
<uocRam>0</uocRam>
<hadIROM>1</hadIROM>
<hadIRAM>1</hadIRAM>
<hadXRAM>0</hadXRAM>
<uocXRam>0</uocXRam>
<RvdsVP>2</RvdsVP>
<RvdsMve>0</RvdsMve>
<RvdsCdeCp>0</RvdsCdeCp>
<hadIRAM2>0</hadIRAM2>
<hadIROM2>0</hadIROM2>
<StupSel>8</StupSel>
<useUlib>1</useUlib>
<EndSel>1</EndSel>
<uLtcg>0</uLtcg>
<nSecure>0</nSecure>
<RoSelD>3</RoSelD>
<RwSelD>3</RwSelD>
<CodeSel>0</CodeSel>
<OptFeed>0</OptFeed>
<NoZi1>0</NoZi1>
<NoZi2>0</NoZi2>
<NoZi3>0</NoZi3>
<NoZi4>0</NoZi4>
<NoZi5>0</NoZi5>
<Ro1Chk>0</Ro1Chk>
<Ro2Chk>0</Ro2Chk>
<Ro3Chk>0</Ro3Chk>
<Ir1Chk>1</Ir1Chk>
<Ir2Chk>0</Ir2Chk>
<Ra1Chk>0</Ra1Chk>
<Ra2Chk>0</Ra2Chk>
<Ra3Chk>0</Ra3Chk>
<Im1Chk>1</Im1Chk>
<Im2Chk>0</Im2Chk>
<OnChipMemories>
<Ocm1>
<Type>0</Type>
<StartAddress>0x0</StartAddress>
<Size>0x0</Size>
</Ocm1>
<Ocm2>
<Type>0</Type>
<StartAddress>0x0</StartAddress>
<Size>0x0</Size>
</Ocm2>
<Ocm3>
<Type>0</Type>
<StartAddress>0x0</StartAddress>
<Size>0x0</Size>
</Ocm3>
<Ocm4>
<Type>0</Type>
<StartAddress>0x0</StartAddress>
<Size>0x0</Size>
</Ocm4>
<Ocm5>
<Type>0</Type>
<StartAddress>0x0</StartAddress>
<Size>0x0</Size>
</Ocm5>
<Ocm6>
<Type>0</Type>
<StartAddress>0x0</StartAddress>
<Size>0x0</Size>
</Ocm6>
<IRAM>
<Type>0</Type>
<StartAddress>0x20000000</StartAddress>
<Size>0x20000</Size>
</IRAM>
<IROM>
<Type>1</Type>
<StartAddress>0x0</StartAddress>
<Size>0x40000</Size>
</IROM>
<XRAM>
<Type>0</Type>
<StartAddress>0x0</StartAddress>
<Size>0x0</Size>
</XRAM>
<OCR_RVCT1>
<Type>1</Type>
<StartAddress>0x0</StartAddress>
<Size>0x0</Size>
</OCR_RVCT1>
<OCR_RVCT2>
<Type>1</Type>
<StartAddress>0x0</StartAddress>
<Size>0x0</Size>
</OCR_RVCT2>
<OCR_RVCT3>
<Type>1</Type>
<StartAddress>0x0</StartAddress>
<Size>0x0</Size>
</OCR_RVCT3>
<OCR_RVCT4>
<Type>1</Type>
<StartAddress>0x0</StartAddress>
<Size>0x10000</Size>
</OCR_RVCT4>
<OCR_RVCT5>
<Type>1</Type>
<StartAddress>0x0</StartAddress>
<Size>0x0</Size>
</OCR_RVCT5>
<OCR_RVCT6>
<Type>0</Type>
<StartAddress>0x0</StartAddress>
<Size>0x0</Size>
</OCR_RVCT6>
<OCR_RVCT7>
<Type>0</Type>
<StartAddress>0x0</StartAddress>
<Size>0x0</Size>
</OCR_RVCT7>
<OCR_RVCT8>
<Type>0</Type>
<StartAddress>0x0</StartAddress>
<Size>0x0</Size>
</OCR_RVCT8>
<OCR_RVCT9>
<Type>0</Type>
<StartAddress>0xfff0000</StartAddress>
<Size>0x10000</Size>
</OCR_RVCT9>
<OCR_RVCT10>
<Type>0</Type>
<StartAddress>0x0</StartAddress>
<Size>0x0</Size>
</OCR_RVCT10>
</OnChipMemories>
<RvctStartVector></RvctStartVector>
</ArmAdsMisc>
<Cads>
<interw>1</interw>
<Optim>4</Optim>
<oTime>0</oTime>
<SplitLS>0</SplitLS>
<OneElfS>1</OneElfS>
<Strict>0</Strict>
<EnumInt>0</EnumInt>
<PlainCh>0</PlainCh>
<Ropi>0</Ropi>
<Rwpi>0</Rwpi>
<wLevel>2</wLevel>
<uThumb>0</uThumb>
<uSurpInc>0</uSurpInc>
<uC99>1</uC99>
<uGnu>0</uGnu>
<useXO>0</useXO>
<v6Lang>1</v6Lang>
<v6LangP>1</v6LangP>
<vShortEn>1</vShortEn>
<vShortWch>1</vShortWch>
<v6Lto>0</v6Lto>
<v6WtE>0</v6WtE>
<v6Rtti>0</v6Rtti>
<VariousControls>
<MiscControls></MiscControls>
<Define>ARM_MATH_CM4, TARGET_NCPU, LOG_ENABLE, KL520</Define>
<Undefine></Undefine>
<IncludePath>..\..\..\..\platform\kl520\common;..\..\..\..\platform\kl520\ncpu\model_ppp\include;..\..\..\..\platform\kl520\ncpu\drv\include;..\..\..\..\platform\kl520\ncpu\rtos\rtx\include;..\..\..\..\include</IncludePath>
</VariousControls>
</Cads>
<Aads>
<interw>1</interw>
<Ropi>0</Ropi>
<Rwpi>0</Rwpi>
<thumb>0</thumb>
<SplitLS>0</SplitLS>
<SwStkChk>0</SwStkChk>
<NoWarn>0</NoWarn>
<uSurpInc>0</uSurpInc>
<useXO>0</useXO>
<ClangAsOpt>13</ClangAsOpt>
<VariousControls>
<MiscControls>--cpreproc</MiscControls>
<Define></Define>
<Undefine></Undefine>
<IncludePath>..\..\..\..\include</IncludePath>
</VariousControls>
</Aads>
<LDads>
<umfTarg>0</umfTarg>
<Ropi>0</Ropi>
<Rwpi>0</Rwpi>
<noStLib>0</noStLib>
<RepFail>0</RepFail>
<useFile>0</useFile>
<TextAddressRange>0x00000000</TextAddressRange>
<DataAddressRange>0x20000000</DataAddressRange>
<pXoBase></pXoBase>
<ScatterFile>..\..\..\..\platform\kl520\ncpu\mozart_ncpu.sct</ScatterFile>
<IncludeLibs></IncludeLibs>
<IncludeLibsPath></IncludeLibsPath>
<Misc></Misc>
<LinkerInputFile></LinkerInputFile>
<DisabledWarnings></DisabledWarnings>
</LDads>
</TargetArmAds>
</TargetOption>
<Groups>
<Group>
<GroupName>main</GroupName>
<Files>
<File>
<FileName>main.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\main_ncpu\main.c</FilePath>
</File>
<File>
<FileName>model_ftr_table.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\main_ncpu\model_ftr_table.c</FilePath>
</File>
</Files>
</Group>
<Group>
<GroupName>libs</GroupName>
<Files>
<File>
<FileName>kdp2_ncpu_sdk.lib</FileName>
<FileType>4</FileType>
<FilePath>..\..\..\..\lib\kdp2_ncpu_sdk.lib</FilePath>
</File>
<File>
<FileName>kdp2_ncpu_model_ppp.lib</FileName>
<FileType>4</FileType>
<FilePath>..\..\..\..\lib\kdp2_ncpu_model_ppp.lib</FilePath>
</File>
</Files>
</Group>
<Group>
<GroupName>rtx</GroupName>
<Files>
<File>
<FileName>irq_cm4f.s</FileName>
<FileType>2</FileType>
<FilePath>..\..\..\..\platform\kl520\ncpu\rtos\rtx\irq_cm4f.s</FilePath>
</File>
<File>
<FileName>os_systick.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\..\..\platform\kl520\ncpu\rtos\rtx\os_systick.c</FilePath>
</File>
<File>
<FileName>RTX_Config.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\..\..\platform\kl520\ncpu\rtos\rtx\RTX_Config.c</FilePath>
</File>
<File>
<FileName>rtx_delay.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\..\..\platform\kl520\ncpu\rtos\rtx\rtx_delay.c</FilePath>
</File>
<File>
<FileName>rtx_evflags.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\..\..\platform\kl520\ncpu\rtos\rtx\rtx_evflags.c</FilePath>
</File>
<File>
<FileName>rtx_evr.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\..\..\platform\kl520\ncpu\rtos\rtx\rtx_evr.c</FilePath>
</File>
<File>
<FileName>rtx_kernel.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\..\..\platform\kl520\ncpu\rtos\rtx\rtx_kernel.c</FilePath>
</File>
<File>
<FileName>rtx_lib.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\..\..\platform\kl520\ncpu\rtos\rtx\rtx_lib.c</FilePath>
</File>
<File>
<FileName>rtx_memory.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\..\..\platform\kl520\ncpu\rtos\rtx\rtx_memory.c</FilePath>
</File>
<File>
<FileName>rtx_mempool.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\..\..\platform\kl520\ncpu\rtos\rtx\rtx_mempool.c</FilePath>
</File>
<File>
<FileName>rtx_msgqueue.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\..\..\platform\kl520\ncpu\rtos\rtx\rtx_msgqueue.c</FilePath>
</File>
<File>
<FileName>rtx_mutex.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\..\..\platform\kl520\ncpu\rtos\rtx\rtx_mutex.c</FilePath>
</File>
<File>
<FileName>rtx_semaphore.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\..\..\platform\kl520\ncpu\rtos\rtx\rtx_semaphore.c</FilePath>
</File>
<File>
<FileName>rtx_system.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\..\..\platform\kl520\ncpu\rtos\rtx\rtx_system.c</FilePath>
</File>
<File>
<FileName>rtx_thread.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\..\..\platform\kl520\ncpu\rtos\rtx\rtx_thread.c</FilePath>
</File>
<File>
<FileName>rtx_timer.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\..\..\platform\kl520\ncpu\rtos\rtx\rtx_timer.c</FilePath>
</File>
</Files>
</Group>
<Group>
<GroupName>startup</GroupName>
<Files>
<File>
<FileName>startup.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\..\..\platform\kl520\ncpu\startup\startup.c</FilePath>
</File>
<File>
<FileName>startup_asm.s</FileName>
<FileType>2</FileType>
<FilePath>..\..\..\..\platform\kl520\ncpu\startup\startup_asm.s</FilePath>
</File>
</Files>
</Group>
</Groups>
</Target>
</Targets>
<RTE>
<apis/>
<components/>
<files>
<file attr="config" category="source" name="CMSIS\RTOS2\RTX\Config\RTX_Config.c" version="5.1.0">
<instance index="0" removed="1">RTE\CMSIS\RTX_Config.c</instance>
<component Capiversion="2.1.3" Cclass="CMSIS" Cgroup="RTOS2" Csub="Keil RTX5" Cvariant="Library" Cvendor="ARM" Cversion="5.4.0" condition="RTOS2 RTX5 Lib"/>
<package name="CMSIS" schemaVersion="1.3" url="http://www.keil.com/pack/" vendor="ARM" version="5.4.0"/>
<targetInfos/>
</file>
<file attr="config" category="header" name="CMSIS\RTOS2\RTX\Config\RTX_Config.h" version="5.4.0">
<instance index="0" removed="1">RTE\CMSIS\RTX_Config.h</instance>
<component Capiversion="2.1.3" Cclass="CMSIS" Cgroup="RTOS2" Csub="Keil RTX5" Cvariant="Library" Cvendor="ARM" Cversion="5.4.0" condition="RTOS2 RTX5 Lib"/>
<package name="CMSIS" schemaVersion="1.3" url="http://www.keil.com/pack/" vendor="ARM" version="5.4.0"/>
<targetInfos/>
</file>
<file attr="config" category="sourceAsm" condition="ARMCC" name="Device\ARM\ARMCM4\Source\ARM\startup_ARMCM4.s" version="1.0.0">
<instance index="0" removed="1">RTE\Device\ARMCM4_FP\startup_ARMCM4.s</instance>
<component Cclass="Device" Cgroup="Startup" Cvendor="ARM" Cversion="1.0.1" condition="ARMCM4 CMSIS"/>
<package name="CMSIS" schemaVersion="1.3" url="http://www.keil.com/pack/" vendor="ARM" version="5.4.0"/>
<targetInfos/>
</file>
<file attr="config" category="sourceC" name="Device\ARM\ARMCM4\Source\system_ARMCM4.c" version="1.0.0">
<instance index="0" removed="1">RTE\Device\ARMCM4_FP\system_ARMCM4.c</instance>
<component Cclass="Device" Cgroup="Startup" Cvendor="ARM" Cversion="1.0.1" condition="ARMCM4 CMSIS"/>
<package name="CMSIS" schemaVersion="1.3" url="http://www.keil.com/pack/" vendor="ARM" version="5.4.0"/>
<targetInfos/>
</file>
</files>
</RTE>
</Project>

View File

@ -0,0 +1,10 @@
@ECHO OFF
REM SET BIN_IN=%1
REM SET BIN_OUT=fw_ncpu.bin
SET BIN_OUT=%1
SET UTILS_PATH=..\..\..\..\utils
copy .\Objects\%BIN_OUT% %UTILS_PATH%\JLink_programmer\bin\
copy .\Objects\%BIN_OUT% %UTILS_PATH%\bin_gen\flash_bin\

View File

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<ProjectWorkspace xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="project_mpw.xsd">
<SchemaVersion>1.0</SchemaVersion>
<Header>### uVision Project, (C) Keil Software</Header>
<WorkspaceName>WorkSpace</WorkspaceName>
<project>
<PathAndName>.\scpu_keil\scpu.uvprojx</PathAndName>
<NodeIsActive>1</NodeIsActive>
<NodeIsExpanded>1</NodeIsExpanded>
</project>
<project>
<PathAndName>.\ncpu_keil\ncpu.uvprojx</PathAndName>
</project>
</ProjectWorkspace>

View File

@ -0,0 +1,182 @@
/* Copyright (c) 2020 Kneron, Inc. All Rights Reserved.
*
* The information contained herein is property of Kneron, Inc.
* Terms and conditions of usage are described in detail in Kneron
* STANDARD SOFTWARE LICENSE AGREEMENT.
*
* Licensees are granted free, non-transferable use of the information.
* NO WARRANTY of ANY KIND is provided. This heading must NOT be removed
* from the file.
*/
/******************************************************************************
* Filename:
* ---------
* project.h
*
* Description:
* ------------
*
*
******************************************************************************/
#ifndef _PROJECT_H_
#define _PROJECT_H_
/*=============================================================================
asic setting
=============================================================================*/
#include "membase.h"
/*=============================================================================
board setting
=============================================================================*/
#include "board.h"
#define FLASH_TYPE FLASH_TYPE_WINBOND_NOR
#define FLASH_SIZE FLASH_SIZE_256MBIT
#define FLASH_COMM FLASH_COMM_SPEED_25MHZ
#define FLASH_DRV FLASH_DRV_NORMAL_MODE
/*=============================================================================
CAM setting
=============================================================================*/
#define IMGSRC_0_FORMAT IMG_FORMAT_YCBCR//IMG_FORMAT_RGB565
#define IMGSRC_0_TYPE IMG_TYPE_RGB
#define IMGSRC_0_RES SENSOR_RES_640_480
#define IMGSRC_0_WIDTH 1920//640
#define IMGSRC_0_HEIGHT 1080//480
#define IMGSRC_0_TILE_AVG 0
#define IMGSRC_0_MIPI_LANE 2
#define IMGSRC_1_FORMAT IMG_FORMAT_RAW8
#define IMGSRC_1_TYPE IMG_TYPE_IR
#define IMGSRC_1_RES SENSOR_RES_480_640
#define IMGSRC_1_WIDTH 480
#define IMGSRC_1_HEIGHT 640
#define IMGSRC_1_TILE_AVG 1
#define IMGSRC_1_MIPI_LANE 2
/*=============================================================================
COMM setting
=============================================================================*/
#define UART_NUM 1
#define MSG_PORT COMM_PORT_ID_0
#define MSG_PORT_BAUDRATE COMM_UART_BAUDRATE_115200
/*=============================================================================
Pinmux setting
=============================================================================*/
#define PIN_NUM 38
#define KDRV_PIN_SPI_WP_N_REG PIN_MODE_0 | (PIN_PULL_NONE << 3) | (PIN_DRIVING_12MA << 6) //0x00000080
#define KDRV_PIN_SPI_HOLD_N_REG PIN_MODE_0 | (PIN_PULL_NONE << 3) | (PIN_DRIVING_12MA << 6) //0x00000080
#define KDRV_PIN_JTAG_TRST_N_REG PIN_MODE_0 | (PIN_PULL_DOWN << 3) | (PIN_DRIVING_12MA << 6) //0x00000090
#define KDRV_PIN_JTAG_TDI_REG PIN_MODE_0 | (PIN_PULL_NONE << 3) | (PIN_DRIVING_12MA << 6) //0x00000080
#define KDRV_PIN_JTAG_SWDITMS_REG PIN_MODE_0 | (PIN_PULL_NONE << 3) | (PIN_DRIVING_12MA << 6) //0x00000080
#define KDRV_PIN_JTAG_SWCLKTCK_REG PIN_MODE_0 | (PIN_PULL_NONE << 3) | (PIN_DRIVING_12MA << 6) //0x00000080
#define KDRV_PIN_JTAG_TDO_REG PIN_MODE_0 | (PIN_PULL_NONE << 3) | (PIN_DRIVING_12MA << 6) //0x00000080
#define KDRV_PIN_LC_PCLK_REG PIN_MODE_0 | (PIN_PULL_NONE << 3) | (PIN_DRIVING_4MA << 6) //0x00000000
#define KDRV_PIN_LC_VS_REG PIN_MODE_0 | (PIN_PULL_NONE << 3) | (PIN_DRIVING_8MA << 6) //0x00000040
#define KDRV_PIN_LC_HS_REG PIN_MODE_0 | (PIN_PULL_NONE << 3) | (PIN_DRIVING_8MA << 6) //0x00000040
#define KDRV_PIN_LC_DE_REG PIN_MODE_0 | (PIN_PULL_NONE << 3) | (PIN_DRIVING_8MA << 6) //0x00000040
#define KDRV_PIN_LC_DATA_0_REG PIN_MODE_3 | (PIN_PULL_NONE << 3) | (PIN_DRIVING_4MA << 6) //0x00000000
#define KDRV_PIN_LC_DATA_1_REG PIN_MODE_0 | (PIN_PULL_NONE << 3) | (PIN_DRIVING_4MA << 6) //0x00000000
#define KDRV_PIN_LC_DATA_2_REG PIN_MODE_0 | (PIN_PULL_NONE << 3) | (PIN_DRIVING_4MA << 6) //0x00000000
#define KDRV_PIN_LC_DATA_3_REG PIN_MODE_0 | (PIN_PULL_NONE << 3) | (PIN_DRIVING_8MA << 6) //0x00000040
#define KDRV_PIN_LC_DATA_4_REG PIN_MODE_0 | (PIN_PULL_NONE << 3) | (PIN_DRIVING_8MA << 6) //0x00000040
#define KDRV_PIN_LC_DATA_5_REG PIN_MODE_0 | (PIN_PULL_NONE << 3) | (PIN_DRIVING_8MA << 6) //0x00000040
#define KDRV_PIN_LC_DATA_6_REG PIN_MODE_0 | (PIN_PULL_NONE << 3) | (PIN_DRIVING_8MA << 6) //0x00000040
#define KDRV_PIN_LC_DATA_7_REG PIN_MODE_0 | (PIN_PULL_NONE << 3) | (PIN_DRIVING_8MA << 6) //0x00000040
#define KDRV_PIN_LC_DATA_8_REG PIN_MODE_0 | (PIN_PULL_NONE << 3) | (PIN_DRIVING_8MA << 6) //0x00000040
#define KDRV_PIN_LC_DATA_9_REG PIN_MODE_0 | (PIN_PULL_NONE << 3) | (PIN_DRIVING_8MA << 6) //0x00000040
#define KDRV_PIN_LC_DATA_10_REG PIN_MODE_0 | (PIN_PULL_NONE << 3) | (PIN_DRIVING_8MA << 6) //0x00000040
#define KDRV_PIN_LC_DATA_11_REG PIN_MODE_0 | (PIN_PULL_NONE << 3) | (PIN_DRIVING_8MA << 6) //0x00000040
#define KDRV_PIN_LC_DATA_12_REG PIN_MODE_0 | (PIN_PULL_NONE << 3) | (PIN_DRIVING_8MA << 6) //0x00000040
#define KDRV_PIN_LC_DATA_13_REG PIN_MODE_0 | (PIN_PULL_NONE << 3) | (PIN_DRIVING_8MA << 6) //0x00000040
#define KDRV_PIN_LC_DATA_14_REG PIN_MODE_0 | (PIN_PULL_NONE << 3) | (PIN_DRIVING_8MA << 6) //0x00000040
#define KDRV_PIN_LC_DATA_15_REG PIN_MODE_0 | (PIN_PULL_NONE << 3) | (PIN_DRIVING_8MA << 6) //0x00000040
#define KDRV_PIN_SD_CLK_REG PIN_MODE_1 | (PIN_PULL_NONE << 3) | (PIN_DRIVING_12MA << 6) //0x00000081
#define KDRV_PIN_SD_CMD_REG PIN_MODE_1 | (PIN_PULL_UP << 3) | (PIN_DRIVING_12MA << 6) //0x00000089
#define KDRV_PIN_SD_DAT_0_REG PIN_MODE_0 | (PIN_PULL_UP << 3) | (PIN_DRIVING_4MA << 6) //0x00000008
#define KDRV_PIN_SD_DAT_1_REG PIN_MODE_0 | (PIN_PULL_UP << 3) | (PIN_DRIVING_4MA << 6) //0x00000008
#define KDRV_PIN_SD_DAT_2_REG PIN_MODE_0 | (PIN_PULL_UP << 3) | (PIN_DRIVING_4MA << 6) //0x00000008
#define KDRV_PIN_SD_DAT_3_REG PIN_MODE_0 | (PIN_PULL_UP << 3) | (PIN_DRIVING_4MA << 6) //0x00000008
#define KDRV_PIN_UART0_RX_REG PIN_MODE_0 | (PIN_PULL_NONE << 3) | (PIN_DRIVING_12MA << 6) //0x00000080
#define KDRV_PIN_UART0_TX_REG PIN_MODE_0 | (PIN_PULL_NONE << 3) | (PIN_DRIVING_12MA << 6) //0x00000080
#define KDRV_PIN_I2C0_SCL_REG PIN_MODE_0 | (PIN_PULL_NONE << 3) | (PIN_DRIVING_4MA << 6) //0x00000000
#define KDRV_PIN_I2C0_SDA_REG PIN_MODE_0 | (PIN_PULL_NONE << 3) | (PIN_DRIVING_4MA << 6) //0x00000000
#define KDRV_PIN_PWM0_REG PIN_MODE_0 | (PIN_PULL_NONE << 3) | (PIN_DRIVING_12MA << 6) //0x00000080
#define PINMUX_ARRAY {KDRV_PIN_SPI_WP_N_REG, KDRV_PIN_SPI_HOLD_N_REG, KDRV_PIN_JTAG_TRST_N_REG, KDRV_PIN_JTAG_TDI_REG, KDRV_PIN_JTAG_SWDITMS_REG,\
KDRV_PIN_JTAG_SWCLKTCK_REG, KDRV_PIN_JTAG_TDO_REG, KDRV_PIN_LC_PCLK_REG, KDRV_PIN_LC_VS_REG, KDRV_PIN_LC_HS_REG,\
KDRV_PIN_LC_DE_REG, KDRV_PIN_LC_DATA_0_REG, KDRV_PIN_LC_DATA_1_REG, KDRV_PIN_LC_DATA_2_REG, KDRV_PIN_LC_DATA_3_REG,\
KDRV_PIN_LC_DATA_4_REG, KDRV_PIN_LC_DATA_5_REG, KDRV_PIN_LC_DATA_6_REG, KDRV_PIN_LC_DATA_7_REG, KDRV_PIN_LC_DATA_8_REG,\
KDRV_PIN_LC_DATA_9_REG, KDRV_PIN_LC_DATA_10_REG, KDRV_PIN_LC_DATA_11_REG, KDRV_PIN_LC_DATA_12_REG, KDRV_PIN_LC_DATA_13_REG,\
KDRV_PIN_LC_DATA_14_REG, KDRV_PIN_LC_DATA_15_REG, KDRV_PIN_SD_CLK_REG, KDRV_PIN_SD_CMD_REG, KDRV_PIN_SD_DAT_0_REG,\
KDRV_PIN_SD_DAT_1_REG, KDRV_PIN_SD_DAT_2_REG, KDRV_PIN_SD_DAT_3_REG, KDRV_PIN_UART0_RX_REG, KDRV_PIN_UART0_TX_REG,\
KDRV_PIN_I2C0_SCL_REG, KDRV_PIN_I2C0_SDA_REG, KDRV_PIN_PWM0_REG};
/*=============================================================================
fw setting
=============================================================================*/
#define OS_DYNAMIC_MEM_SIZE (1024*32) /**< available memory size in RTX*/
/*=============================================================================
DDR configuration
=============================================================================*/
/* DDR table */
#define DDR_BEGIN DDR_MEM_BASE /**< = 0x60000000, definded in regbase.h*/
#define DDR_END (DDR_MEM_BASE + DDR_MEM_SIZE - 1) /**< DDR end address */
/** Reserve for all_models.bin */
#define DDR_MODEL_RESERVED_BEGIN KDP_DDR_BASE /**< space head for model data */
#define DDR_MODEL_RESERVED_END 0x613FFFFF /**< space end for model data(initial boundary) */
/** Resseve for DDR heap. Allocation direction from END to BEGIN */
#define DDR_HEAP_BEGIN 0x61400000 /**< space head for HEAP (initial boundary) */
#define DDR_HEAP_END 0x63FCFFFF /**< space end for HEAP */
/** Reserve for system information, 188KB */
#define DDR_SYSTEM_RESERVED_BEGIN 0x63FD0000 /**< space head for system info */
#define DDR_SYSTEM_RESERVED_END 0x63FFEFFF /**< space end for system info */
/** Definition of snapshot image address and size, for kdrv_lcdc debug only*/
#define KDP_DDR_SNAPSHOT_RGB_IMG_SIZE 0x96000 /* 640x480x2(RGB565) */
#define KDP_DDR_SNAPSHOT_NIR_IMG_SIZE 0x4B000 /* 480x640x1(RAW8) */
#define KDP_DDR_SNAPSHOT_RGB_IMG_ADDR DDR_MODEL_RESERVED_END
#define KDP_DDR_SNAPSHOT_NIR_IMG_ADDR (DDR_MODEL_RESERVED_END + KDP_DDR_SNAPSHOT_RGB_IMG_SIZE )
/*=============================================================================
Flash configuration
=============================================================================*/
/* Flash table */
#define FLASH_FW_SCPU0_ADDR 0x00002000 /**< fw_scpu.bin */
#define FLASH_FW_NCPU0_ADDR 0x00018000 /**< fw_ncpu.bin */
#define FLASH_FW_CFG0_ADDR 0x00028000 /**< boot_cfg0.bin */
#define FLASH_FW_SCPU1_ADDR 0x00041000 /**< fw_scpu1.bin */
#define FLASH_FW_NCPU1_ADDR 0x00057000 /**< fw_ncpu1.bin */
#define FLASH_FW_CFG1_ADDR 0x00067000 /**< boot_cfg1.bin */
#define FLASH_MODEL_FW_INFO_ADDR 0x00300000 /**< fw_info.bin */
#define FLASH_MODEL_ALL_ADDR 0x00301000 /**< all_models.bin */
#define FLASH_END_ADDR 0x01FFFFFF /**< end addr of 32MB flash */
#define FLASH_MINI_BLOCK_SIZE (4 * 1024)
/*=============================================================================
mdw setting
=============================================================================*/
/* scpu/ncpu image size */
#define SCPU_IMAGE_SIZE (SiRAM_MEM_SIZE - 0x2000)
#define NCPU_IMAGE_SIZE NiRAM_MEM_SIZE
/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-->critical setting<--
Below setting is for RD tuning or testing.
**Don't touch anything if you don't know what you are doing**
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
#endif //_PROJECT_H_

View File

@ -0,0 +1,13 @@
MEMSET(0x10200000, 0x18000, 0)
MEMSET(0x10210000, 0x08000, 0)
// to let USB know this is running in JTAG mode
MEMSET(0x10100000, 1, 0x01)
MEMSET(0x10100001, 1, 0xBA)
MEMSET(0x10100002, 1, 0xDC)
MEMSET(0x10100003, 1, 0xFE)
_WDWORD(0xE000ED08, 0x10102000);
SP=_RDWORD(0x10104000) // Set Stack Pointer
PC=_RDWORD(0x10104004) // Set Program Counter = Reset_Handler
BS main

View File

@ -0,0 +1,12 @@
@ECHO OFF
REM SET BIN_IN=%1
REM SET BIN_OUT=fw_scpu.bin
SET BIN_OUT=%1
SET UTILS_PATH=..\..\..\..\utils
copy .\Objects\%BIN_OUT% %UTILS_PATH%\JLink_programmer\bin\
copy .\Objects\%BIN_OUT% %UTILS_PATH%\bin_gen\flash_bin\

View File

@ -0,0 +1 @@
REM "prebuild script"

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,853 @@
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<Project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="project_projx.xsd">
<SchemaVersion>2.1</SchemaVersion>
<Header>### uVision Project, (C) Keil Software</Header>
<Targets>
<Target>
<TargetName>dev</TargetName>
<ToolsetNumber>0x4</ToolsetNumber>
<ToolsetName>ARM-ADS</ToolsetName>
<pCCUsed>5060960::V5.06 update 7 (build 960)::.\ARMCC</pCCUsed>
<uAC6>0</uAC6>
<TargetOption>
<TargetCommonOption>
<Device>ARMCM4_FP</Device>
<Vendor>ARM</Vendor>
<PackID>ARM.CMSIS.5.7.0</PackID>
<PackURL>http://www.keil.com/pack/</PackURL>
<Cpu>IRAM(0x20000000,0x00020000) IROM(0x00000000,0x00040000) CPUTYPE("Cortex-M4") FPU2 CLOCK(12000000) ESEL ELITTLE</Cpu>
<FlashUtilSpec></FlashUtilSpec>
<StartupFile></StartupFile>
<FlashDriverDll>UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000)</FlashDriverDll>
<DeviceId>0</DeviceId>
<RegisterFile>$$Device:ARMCM4_FP$Device\ARM\ARMCM4\Include\ARMCM4_FP.h</RegisterFile>
<MemoryEnv></MemoryEnv>
<Cmp></Cmp>
<Asm></Asm>
<Linker></Linker>
<OHString></OHString>
<InfinionOptionDll></InfinionOptionDll>
<SLE66CMisc></SLE66CMisc>
<SLE66AMisc></SLE66AMisc>
<SLE66LinkerMisc></SLE66LinkerMisc>
<SFDFile>$$Device:ARMCM4_FP$Device\ARM\SVD\ARMCM4.svd</SFDFile>
<bCustSvd>0</bCustSvd>
<UseEnv>0</UseEnv>
<BinPath></BinPath>
<IncludePath></IncludePath>
<LibPath></LibPath>
<RegisterFilePath></RegisterFilePath>
<DBRegisterFilePath></DBRegisterFilePath>
<TargetStatus>
<Error>0</Error>
<ExitCodeStop>0</ExitCodeStop>
<ButtonStop>0</ButtonStop>
<NotGenerated>0</NotGenerated>
<InvalidFlash>1</InvalidFlash>
</TargetStatus>
<OutputDirectory>.\Objects\</OutputDirectory>
<OutputName>scpu_fw</OutputName>
<CreateExecutable>1</CreateExecutable>
<CreateLib>0</CreateLib>
<CreateHexFile>0</CreateHexFile>
<DebugInformation>1</DebugInformation>
<BrowseInformation>1</BrowseInformation>
<ListingPath>.\Listings\</ListingPath>
<HexFormatSelection>1</HexFormatSelection>
<Merge32K>0</Merge32K>
<CreateBatchFile>0</CreateBatchFile>
<BeforeCompile>
<RunUserProg1>0</RunUserProg1>
<RunUserProg2>0</RunUserProg2>
<UserProg1Name></UserProg1Name>
<UserProg2Name></UserProg2Name>
<UserProg1Dos16Mode>0</UserProg1Dos16Mode>
<UserProg2Dos16Mode>0</UserProg2Dos16Mode>
<nStopU1X>0</nStopU1X>
<nStopU2X>0</nStopU2X>
</BeforeCompile>
<BeforeMake>
<RunUserProg1>1</RunUserProg1>
<RunUserProg2>0</RunUserProg2>
<UserProg1Name>pre_build.bat</UserProg1Name>
<UserProg2Name></UserProg2Name>
<UserProg1Dos16Mode>0</UserProg1Dos16Mode>
<UserProg2Dos16Mode>0</UserProg2Dos16Mode>
<nStopB1X>0</nStopB1X>
<nStopB2X>0</nStopB2X>
</BeforeMake>
<AfterMake>
<RunUserProg1>1</RunUserProg1>
<RunUserProg2>1</RunUserProg2>
<UserProg1Name>fromelf.exe --bin "!L" --output ".\Objects\fw_scpu.bin"</UserProg1Name>
<UserProg2Name>post_build.bat fw_scpu.bin</UserProg2Name>
<UserProg1Dos16Mode>0</UserProg1Dos16Mode>
<UserProg2Dos16Mode>0</UserProg2Dos16Mode>
<nStopA1X>0</nStopA1X>
<nStopA2X>0</nStopA2X>
</AfterMake>
<SelectedForBatchBuild>1</SelectedForBatchBuild>
<SVCSIdString></SVCSIdString>
</TargetCommonOption>
<CommonProperty>
<UseCPPCompiler>0</UseCPPCompiler>
<RVCTCodeConst>0</RVCTCodeConst>
<RVCTZI>0</RVCTZI>
<RVCTOtherData>0</RVCTOtherData>
<ModuleSelection>0</ModuleSelection>
<IncludeInBuild>1</IncludeInBuild>
<AlwaysBuild>0</AlwaysBuild>
<GenerateAssemblyFile>0</GenerateAssemblyFile>
<AssembleAssemblyFile>0</AssembleAssemblyFile>
<PublicsOnly>0</PublicsOnly>
<StopOnExitCode>3</StopOnExitCode>
<CustomArgument></CustomArgument>
<IncludeLibraryModules></IncludeLibraryModules>
<ComprImg>1</ComprImg>
</CommonProperty>
<DllOption>
<SimDllName>SARMCM3.DLL</SimDllName>
<SimDllArguments> -MPU</SimDllArguments>
<SimDlgDll>DCM.DLL</SimDlgDll>
<SimDlgDllArguments>-pCM4</SimDlgDllArguments>
<TargetDllName>SARMCM3.DLL</TargetDllName>
<TargetDllArguments> -MPU</TargetDllArguments>
<TargetDlgDll>TCM.DLL</TargetDlgDll>
<TargetDlgDllArguments>-pCM4</TargetDlgDllArguments>
</DllOption>
<DebugOption>
<OPTHX>
<HexSelection>1</HexSelection>
<HexRangeLowAddress>0</HexRangeLowAddress>
<HexRangeHighAddress>0</HexRangeHighAddress>
<HexOffset>0</HexOffset>
<Oh166RecLen>16</Oh166RecLen>
</OPTHX>
</DebugOption>
<Utilities>
<Flash1>
<UseTargetDll>1</UseTargetDll>
<UseExternalTool>0</UseExternalTool>
<RunIndependent>0</RunIndependent>
<UpdateFlashBeforeDebugging>0</UpdateFlashBeforeDebugging>
<Capability>1</Capability>
<DriverSelection>4099</DriverSelection>
</Flash1>
<bUseTDR>0</bUseTDR>
<Flash2>Segger\JL2CM3.dll</Flash2>
<Flash3>"" ()</Flash3>
<Flash4></Flash4>
<pFcarmOut></pFcarmOut>
<pFcarmGrp></pFcarmGrp>
<pFcArmRoot></pFcArmRoot>
<FcArmLst>0</FcArmLst>
</Utilities>
<TargetArmAds>
<ArmAdsMisc>
<GenerateListings>0</GenerateListings>
<asHll>1</asHll>
<asAsm>1</asAsm>
<asMacX>1</asMacX>
<asSyms>1</asSyms>
<asFals>1</asFals>
<asDbgD>1</asDbgD>
<asForm>1</asForm>
<ldLst>0</ldLst>
<ldmm>1</ldmm>
<ldXref>1</ldXref>
<BigEnd>0</BigEnd>
<AdsALst>1</AdsALst>
<AdsACrf>1</AdsACrf>
<AdsANop>0</AdsANop>
<AdsANot>0</AdsANot>
<AdsLLst>1</AdsLLst>
<AdsLmap>1</AdsLmap>
<AdsLcgr>1</AdsLcgr>
<AdsLsym>1</AdsLsym>
<AdsLszi>1</AdsLszi>
<AdsLtoi>1</AdsLtoi>
<AdsLsun>1</AdsLsun>
<AdsLven>1</AdsLven>
<AdsLsxf>1</AdsLsxf>
<RvctClst>1</RvctClst>
<GenPPlst>0</GenPPlst>
<AdsCpuType>"Cortex-M4"</AdsCpuType>
<RvctDeviceName></RvctDeviceName>
<mOS>0</mOS>
<uocRom>0</uocRom>
<uocRam>0</uocRam>
<hadIROM>1</hadIROM>
<hadIRAM>1</hadIRAM>
<hadXRAM>0</hadXRAM>
<uocXRam>0</uocXRam>
<RvdsVP>2</RvdsVP>
<RvdsMve>0</RvdsMve>
<RvdsCdeCp>0</RvdsCdeCp>
<hadIRAM2>0</hadIRAM2>
<hadIROM2>0</hadIROM2>
<StupSel>8</StupSel>
<useUlib>1</useUlib>
<EndSel>1</EndSel>
<uLtcg>0</uLtcg>
<nSecure>0</nSecure>
<RoSelD>3</RoSelD>
<RwSelD>3</RwSelD>
<CodeSel>0</CodeSel>
<OptFeed>0</OptFeed>
<NoZi1>0</NoZi1>
<NoZi2>0</NoZi2>
<NoZi3>0</NoZi3>
<NoZi4>0</NoZi4>
<NoZi5>0</NoZi5>
<Ro1Chk>0</Ro1Chk>
<Ro2Chk>0</Ro2Chk>
<Ro3Chk>0</Ro3Chk>
<Ir1Chk>1</Ir1Chk>
<Ir2Chk>0</Ir2Chk>
<Ra1Chk>0</Ra1Chk>
<Ra2Chk>0</Ra2Chk>
<Ra3Chk>0</Ra3Chk>
<Im1Chk>1</Im1Chk>
<Im2Chk>0</Im2Chk>
<OnChipMemories>
<Ocm1>
<Type>0</Type>
<StartAddress>0x0</StartAddress>
<Size>0x0</Size>
</Ocm1>
<Ocm2>
<Type>0</Type>
<StartAddress>0x0</StartAddress>
<Size>0x0</Size>
</Ocm2>
<Ocm3>
<Type>0</Type>
<StartAddress>0x0</StartAddress>
<Size>0x0</Size>
</Ocm3>
<Ocm4>
<Type>0</Type>
<StartAddress>0x0</StartAddress>
<Size>0x0</Size>
</Ocm4>
<Ocm5>
<Type>0</Type>
<StartAddress>0x0</StartAddress>
<Size>0x0</Size>
</Ocm5>
<Ocm6>
<Type>0</Type>
<StartAddress>0x0</StartAddress>
<Size>0x0</Size>
</Ocm6>
<IRAM>
<Type>0</Type>
<StartAddress>0x20000000</StartAddress>
<Size>0x20000</Size>
</IRAM>
<IROM>
<Type>1</Type>
<StartAddress>0x0</StartAddress>
<Size>0x40000</Size>
</IROM>
<XRAM>
<Type>0</Type>
<StartAddress>0x0</StartAddress>
<Size>0x0</Size>
</XRAM>
<OCR_RVCT1>
<Type>1</Type>
<StartAddress>0x0</StartAddress>
<Size>0x0</Size>
</OCR_RVCT1>
<OCR_RVCT2>
<Type>1</Type>
<StartAddress>0x0</StartAddress>
<Size>0x0</Size>
</OCR_RVCT2>
<OCR_RVCT3>
<Type>1</Type>
<StartAddress>0x0</StartAddress>
<Size>0x0</Size>
</OCR_RVCT3>
<OCR_RVCT4>
<Type>1</Type>
<StartAddress>0x10102000</StartAddress>
<Size>0x16000</Size>
</OCR_RVCT4>
<OCR_RVCT5>
<Type>1</Type>
<StartAddress>0x0</StartAddress>
<Size>0x0</Size>
</OCR_RVCT5>
<OCR_RVCT6>
<Type>0</Type>
<StartAddress>0x0</StartAddress>
<Size>0x0</Size>
</OCR_RVCT6>
<OCR_RVCT7>
<Type>0</Type>
<StartAddress>0x0</StartAddress>
<Size>0x0</Size>
</OCR_RVCT7>
<OCR_RVCT8>
<Type>0</Type>
<StartAddress>0x0</StartAddress>
<Size>0x0</Size>
</OCR_RVCT8>
<OCR_RVCT9>
<Type>0</Type>
<StartAddress>0x10200000</StartAddress>
<Size>0x16000</Size>
</OCR_RVCT9>
<OCR_RVCT10>
<Type>0</Type>
<StartAddress>0x0</StartAddress>
<Size>0x0</Size>
</OCR_RVCT10>
</OnChipMemories>
<RvctStartVector></RvctStartVector>
</ArmAdsMisc>
<Cads>
<interw>1</interw>
<Optim>4</Optim>
<oTime>0</oTime>
<SplitLS>0</SplitLS>
<OneElfS>1</OneElfS>
<Strict>0</Strict>
<EnumInt>0</EnumInt>
<PlainCh>0</PlainCh>
<Ropi>0</Ropi>
<Rwpi>0</Rwpi>
<wLevel>2</wLevel>
<uThumb>0</uThumb>
<uSurpInc>0</uSurpInc>
<uC99>1</uC99>
<uGnu>0</uGnu>
<useXO>0</useXO>
<v6Lang>1</v6Lang>
<v6LangP>1</v6LangP>
<vShortEn>1</vShortEn>
<vShortWch>1</vShortWch>
<v6Lto>0</v6Lto>
<v6WtE>0</v6WtE>
<v6Rtti>0</v6Rtti>
<VariousControls>
<MiscControls>--gnu</MiscControls>
<Define>ARM_MATH_CM4, KL520, TARGET_SCPU, LOG_ENABLE, BOARD_96</Define>
<Undefine></Undefine>
<IncludePath>..\..\..\..\include;..\..\..\..\platform\kl520\common;..\..\..\..\platform\kl520\scpu\drv\include;..\..\..\..\platform\kl520\scpu\rtos\rtx\include;..\..\..\..\platform\board\board_sn52096;..\..\..\..\platform\dev\include;..\..\..\..\mdw\include;..\..\..\..\mdw\inference;..\..\..\..\app;..\..\main_scpu\include;..\;..\..\..\lib\system_520\main_scpu\include</IncludePath>
</VariousControls>
</Cads>
<Aads>
<interw>1</interw>
<Ropi>0</Ropi>
<Rwpi>0</Rwpi>
<thumb>0</thumb>
<SplitLS>0</SplitLS>
<SwStkChk>0</SwStkChk>
<NoWarn>0</NoWarn>
<uSurpInc>0</uSurpInc>
<useXO>0</useXO>
<ClangAsOpt>4</ClangAsOpt>
<VariousControls>
<MiscControls>--cpreproc</MiscControls>
<Define></Define>
<Undefine></Undefine>
<IncludePath>..\..\sn52096;..\..\..\..\include;..\..\..\..\platform\kl520\common;..\..\..\..\platform\board\board_sn52096</IncludePath>
</VariousControls>
</Aads>
<LDads>
<umfTarg>0</umfTarg>
<Ropi>0</Ropi>
<Rwpi>0</Rwpi>
<noStLib>0</noStLib>
<RepFail>0</RepFail>
<useFile>0</useFile>
<TextAddressRange>0x10100000</TextAddressRange>
<DataAddressRange>0x10200000</DataAddressRange>
<pXoBase></pXoBase>
<ScatterFile>..\..\..\..\platform\kl520\scpu\scatter_load.sct</ScatterFile>
<IncludeLibs></IncludeLibs>
<IncludeLibsPath></IncludeLibsPath>
<Misc></Misc>
<LinkerInputFile></LinkerInputFile>
<DisabledWarnings></DisabledWarnings>
</LDads>
</TargetArmAds>
</TargetOption>
<Groups>
<Group>
<GroupName>main</GroupName>
<Files>
<File>
<FileName>main.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\main_scpu\main.c</FilePath>
</File>
<File>
<FileName>project.h</FileName>
<FileType>5</FileType>
<FilePath>..\project.h</FilePath>
</File>
<File>
<FileName>application_init.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\main_scpu\application_init.c</FilePath>
</File>
<File>
<FileName>device_init.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\main_scpu\device_init.c</FilePath>
</File>
<File>
<FileName>driver_init.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\main_scpu\driver_init.c</FilePath>
</File>
<File>
<FileName>middleware_init.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\main_scpu\middleware_init.c</FilePath>
</File>
<File>
<FileName>system_init.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\main_scpu\system_init.c</FilePath>
</File>
<File>
<FileName>task_handler.h</FileName>
<FileType>5</FileType>
<FilePath>..\..\main_scpu\include\task_handler.h</FilePath>
</File>
<File>
<FileName>display_init.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\main_scpu\display_init.c</FilePath>
</File>
<File>
<FileName>kdev_sensor_imx462.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\main_scpu\kdev_sensor_imx462.c</FilePath>
</File>
</Files>
</Group>
<Group>
<GroupName>inf_app</GroupName>
<Files>
<File>
<FileName>demo_customize_inf_single_model.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\..\..\app\demo_customize_inf_single_model.c</FilePath>
</File>
<File>
<FileName>demo_customize_inf_multiple_models.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\..\..\app\demo_customize_inf_multiple_models.c</FilePath>
</File>
<File>
<FileName>kdp2_inf_app_yolo.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\..\..\app\kdp2_inf_app_yolo.c</FilePath>
</File>
</Files>
</Group>
<Group>
<GroupName>inf_client</GroupName>
<Files>
<File>
<FileName>kdp2_cmd_handler_520.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\..\..\mdw\usb_companion\kdp2_cmd_handler_520.c</FilePath>
</File>
<File>
<FileName>usbd_hal_520.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\..\..\mdw\usb_companion\usbd_hal_520.c</FilePath>
</File>
<File>
<FileName>kdp2_usb_log.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\..\..\mdw\usb_companion\kdp2_usb_log.c</FilePath>
</File>
<File>
<FileName>kdp2_hico_mipi.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\main_scpu\kdp2_hico_mipi.c</FilePath>
</File>
</Files>
</Group>
<Group>
<GroupName>middleware</GroupName>
<Files>
<File>
<FileName>kmdw_memory.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\..\..\mdw\memory\kmdw_memory.c</FilePath>
</File>
<File>
<FileName>kmdw_memxfer.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\..\..\mdw\flash\kmdw_memxfer.c</FilePath>
</File>
<File>
<FileName>kmdw_console.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\..\..\mdw\console\kmdw_console.c</FilePath>
</File>
<File>
<FileName>kmdw_power_manager.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\..\..\mdw\power\kmdw_power_manager.c</FilePath>
</File>
<File>
<FileName>kmdw_dfu.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\..\..\mdw\dfu\kmdw_dfu.c</FilePath>
</File>
<File>
<FileName>kdp_crc.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\..\..\mdw\utils\kmdw_utils_crc.c</FilePath>
</File>
<File>
<FileName>kmdw_system.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\..\..\mdw\system\kmdw_system.c</FilePath>
</File>
<File>
<FileName>kmdw_ipc.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\..\..\mdw\ipc\kmdw_ipc.c</FilePath>
</File>
<File>
<FileName>kmdw_model.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\..\..\mdw\model\kmdw_model.c</FilePath>
</File>
<File>
<FileName>dual_fifo2.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\..\..\mdw\inference\dual_fifo2.c</FilePath>
</File>
<File>
<FileName>kdp2_inf_generic_raw.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\..\..\mdw\inference\kdp2_inf_generic_raw.c</FilePath>
</File>
<File>
<FileName>kmdw_inference_520.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\..\..\mdw\inference\kmdw_inference_520.c</FilePath>
</File>
<File>
<FileName>kmdw_camera.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\..\..\mdw\camera\kmdw_camera.c</FilePath>
</File>
<File>
<FileName>kmdw_camera_kl520.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\..\..\mdw\camera\kmdw_camera_kl520.c</FilePath>
</File>
<File>
<FileName>kmdw_sensor.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\..\..\mdw\camera\kmdw_sensor.c</FilePath>
</File>
<File>
<FileName>kmdw_display.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\..\..\mdw\display\kmdw_display.c</FilePath>
</File>
<File>
<FileName>kmdw_fifoq_manager.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\..\..\mdw\inference\kmdw_fifoq_manager.c</FilePath>
</File>
</Files>
</Group>
<Group>
<GroupName>device</GroupName>
<Files>
<File>
<FileName>kdev_flash_winbond.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\..\..\platform\dev\flash\kdev_flash_winbond.c</FilePath>
</File>
<File>
<FileName>kdev_sensor_gc2145.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\..\..\platform\dev\sensor\kdev_sensor_gc2145.c</FilePath>
</File>
<File>
<FileName>kdev_sensor_sc132gs.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\..\..\platform\dev\sensor\kdev_sensor_sc132gs.c</FilePath>
</File>
<File>
<FileName>kdev_mzt_480x272.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\..\..\platform\dev\panel\kdev_mzt_480x272.c</FilePath>
</File>
</Files>
</Group>
<Group>
<GroupName>driver</GroupName>
<Files>
<File>
<FileName>kdrv_pinmux.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\..\..\platform\kl520\scpu\drv\kdrv_pinmux.c</FilePath>
</File>
<File>
<FileName>kdrv_gpio.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\..\..\platform\kl520\scpu\drv\kdrv_gpio.c</FilePath>
</File>
<File>
<FileName>kdrv_spif.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\..\..\platform\kl520\scpu\drv\kdrv_spif.c</FilePath>
</File>
<File>
<FileName>kdrv_uart.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\..\..\platform\kl520\scpu\drv\kdrv_uart.c</FilePath>
</File>
<File>
<FileName>kdrv_ipc.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\..\..\platform\kl520\scpu\drv\kdrv_ipc.c</FilePath>
</File>
<File>
<FileName>kdrv_usbd2.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\..\..\platform\kl520\scpu\drv\kdrv_usbd2.c</FilePath>
</File>
<File>
<FileName>kdrv_usbd2v.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\..\..\platform\kl520\scpu\drv\kdrv_usbd2v.c</FilePath>
</File>
<File>
<FileName>kdrv_clock.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\..\..\platform\kl520\scpu\drv\kdrv_clock.c</FilePath>
</File>
<File>
<FileName>kdrv_mpu.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\..\..\platform\kl520\scpu\drv\kdrv_mpu.c</FilePath>
</File>
<File>
<FileName>kdrv_ddr.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\..\..\platform\kl520\scpu\drv\kdrv_ddr.c</FilePath>
</File>
<File>
<FileName>kdrv_power.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\..\..\platform\kl520\scpu\drv\kdrv_power.c</FilePath>
</File>
<File>
<FileName>kdrv_system.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\..\..\platform\kl520\scpu\drv\kdrv_system.c</FilePath>
</File>
<File>
<FileName>kdrv_wdt.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\..\..\platform\kl520\scpu\drv\kdrv_wdt.c</FilePath>
</File>
<File>
<FileName>kdrv_gdma.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\..\..\platform\kl520\scpu\drv\kdrv_gdma.c</FilePath>
</File>
<File>
<FileName>rtc.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\..\..\platform\kl520\scpu\drv\rtc.c</FilePath>
</File>
<File>
<FileName>kdrv_pwm.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\..\..\platform\kl520\scpu\drv\kdrv_pwm.c</FilePath>
</File>
<File>
<FileName>kdrv_lcdc.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\..\..\platform\kl520\scpu\drv\kdrv_lcdc.c</FilePath>
</File>
<File>
<FileName>kdrv_i2c.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\..\..\platform\kl520\scpu\drv\kdrv_i2c.c</FilePath>
</File>
<File>
<FileName>kdrv_mipicsirx.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\..\..\platform\kl520\scpu\drv\kdrv_mipicsirx.c</FilePath>
</File>
<File>
<FileName>kdrv_dpi2ahb.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\..\..\platform\kl520\scpu\drv\kdrv_dpi2ahb.c</FilePath>
</File>
</Files>
</Group>
<Group>
<GroupName>rtx</GroupName>
<Files>
<File>
<FileName>irq_cm4f.s</FileName>
<FileType>2</FileType>
<FilePath>..\..\..\..\platform\kl520\scpu\rtos\rtx\irq_cm4f.s</FilePath>
</File>
<File>
<FileName>os_systick.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\..\..\platform\kl520\scpu\rtos\rtx\os_systick.c</FilePath>
</File>
<File>
<FileName>RTX_Config.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\..\..\platform\kl520\scpu\rtos\rtx\RTX_Config.c</FilePath>
</File>
<File>
<FileName>rtx_delay.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\..\..\platform\kl520\scpu\rtos\rtx\rtx_delay.c</FilePath>
</File>
<File>
<FileName>rtx_evflags.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\..\..\platform\kl520\scpu\rtos\rtx\rtx_evflags.c</FilePath>
</File>
<File>
<FileName>rtx_evr.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\..\..\platform\kl520\scpu\rtos\rtx\rtx_evr.c</FilePath>
</File>
<File>
<FileName>rtx_kernel.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\..\..\platform\kl520\scpu\rtos\rtx\rtx_kernel.c</FilePath>
</File>
<File>
<FileName>rtx_lib.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\..\..\platform\kl520\scpu\rtos\rtx\rtx_lib.c</FilePath>
</File>
<File>
<FileName>rtx_memory.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\..\..\platform\kl520\scpu\rtos\rtx\rtx_memory.c</FilePath>
</File>
<File>
<FileName>rtx_mempool.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\..\..\platform\kl520\scpu\rtos\rtx\rtx_mempool.c</FilePath>
</File>
<File>
<FileName>rtx_msgqueue.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\..\..\platform\kl520\scpu\rtos\rtx\rtx_msgqueue.c</FilePath>
</File>
<File>
<FileName>rtx_mutex.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\..\..\platform\kl520\scpu\rtos\rtx\rtx_mutex.c</FilePath>
</File>
<File>
<FileName>rtx_semaphore.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\..\..\platform\kl520\scpu\rtos\rtx\rtx_semaphore.c</FilePath>
</File>
<File>
<FileName>rtx_system.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\..\..\platform\kl520\scpu\rtos\rtx\rtx_system.c</FilePath>
</File>
<File>
<FileName>rtx_thread.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\..\..\platform\kl520\scpu\rtos\rtx\rtx_thread.c</FilePath>
</File>
<File>
<FileName>rtx_timer.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\..\..\platform\kl520\scpu\rtos\rtx\rtx_timer.c</FilePath>
</File>
<File>
<FileName>task_handler.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\..\..\platform\kl520\scpu\rtos\rtx\task_handler.c</FilePath>
</File>
</Files>
</Group>
<Group>
<GroupName>startup</GroupName>
<Files>
<File>
<FileName>startup.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\..\..\platform\kl520\scpu\startup\startup.c</FilePath>
</File>
<File>
<FileName>startup_asm.s</FileName>
<FileType>2</FileType>
<FilePath>..\..\..\..\platform\kl520\scpu\startup\startup_asm.s</FilePath>
</File>
</Files>
</Group>
<Group>
<GroupName>libs</GroupName>
<Files>
<File>
<FileName>system_520.lib</FileName>
<FileType>4</FileType>
<FilePath>..\..\..\..\lib\system_520.lib</FilePath>
</File>
</Files>
</Group>
</Groups>
</Target>
</Targets>
<RTE>
<apis/>
<components/>
<files>
<file attr="config" category="source" name="CMSIS\RTOS2\RTX\Config\RTX_Config.c" version="0.0.0">
<instance index="0" removed="1">RTE\CMSIS\RTX_Config.c</instance>
<component Capiversion="2.1.3" Cclass="CMSIS" Cgroup="RTOS2" Csub="Keil RTX5" Cvariant="Library" Cvendor="ARM" Cversion="5.4.0" condition="RTOS2 RTX5 Lib"/>
<package name="CMSIS" schemaVersion="1.3" url="http://www.keil.com/pack/" vendor="ARM" version="5.4.0"/>
<targetInfos/>
</file>
<file attr="config" category="header" name="CMSIS\RTOS2\RTX\Config\RTX_Config.h" version="0.0.0">
<instance index="0" removed="1">RTE\CMSIS\RTX_Config.h</instance>
<component Capiversion="2.1.3" Cclass="CMSIS" Cgroup="RTOS2" Csub="Keil RTX5" Cvariant="Library" Cvendor="ARM" Cversion="5.4.0" condition="RTOS2 RTX5 Lib"/>
<package name="CMSIS" schemaVersion="1.3" url="http://www.keil.com/pack/" vendor="ARM" version="5.4.0"/>
<targetInfos/>
</file>
<file attr="config" category="sourceAsm" condition="ARMCC" name="Device\ARM\ARMCM4\Source\ARM\startup_ARMCM4.s" version="0.0.0">
<instance index="0" removed="1">RTE\Device\ARMCM4_FP\startup_ARMCM4.s</instance>
<component Cclass="Device" Cgroup="Startup" Cvendor="ARM" Cversion="1.0.1" condition="ARMCM4 CMSIS"/>
<package name="CMSIS" schemaVersion="1.3" url="http://www.keil.com/pack/" vendor="ARM" version="5.4.0"/>
<targetInfos/>
</file>
<file attr="config" category="sourceC" name="Device\ARM\ARMCM4\Source\system_ARMCM4.c" version="0.0.0">
<instance index="0" removed="1">RTE\Device\ARMCM4_FP\system_ARMCM4.c</instance>
<component Cclass="Device" Cgroup="Startup" Cvendor="ARM" Cversion="1.0.1" condition="ARMCM4 CMSIS"/>
<package name="CMSIS" schemaVersion="1.3" url="http://www.keil.com/pack/" vendor="ARM" version="5.4.0"/>
<targetInfos/>
</file>
</files>
</RTE>
</Project>

View File

@ -78,7 +78,7 @@ static kmdw_status_t kmdw_cam_set_format(uint32_t cam_idx, struct cam_format *fo
ctx->fmt = *format;
if (format->pixelformat == IMG_FORMAT_RGB565)
if (format->pixelformat == IMG_FORMAT_RGB565 || format->pixelformat == IMG_FORMAT_YCBCR)
bpp = 2;
else if (format->pixelformat == IMG_FORMAT_RAW8)
{
@ -116,7 +116,7 @@ static kmdw_status_t kmdw_cam_buffer_init(uint32_t cam_idx, uint32_t buf_addr_0,
struct kmdw_cam_context *ctx = &cam_ctx[cam_idx];
cam_msg("cam %d: size=%d\n", cam_idx, ctx->fmt.sizeimage);
kdrv_dpi2ahb_buf_init(cam_idx, buf_addr_0, buf_addr_1);
return KMDW_STATUS_OK;

View File

@ -13,6 +13,7 @@
#if defined(BOARD_96) || defined(BOARD_DVP_EXAMPLE)
extern struct sensor_ops* kdev_sensor_gc2145_get_ops(void);
extern struct sensor_ops* kdev_sensor_imx462_get_ops(void);
extern struct sensor_ops* kdev_sensor_sc132gs_get_ops(void);
#endif
@ -190,6 +191,9 @@ struct sensor_ops * kmdw_sensor_get_ops(uint32_t sensor_idx)
case SENSOR_ID_GC2145:
pops = kdev_sensor_gc2145_get_ops();
break;
case SENSOR_ID_IMX462:
pops = kdev_sensor_imx462_get_ops();
break;
case SENSOR_ID_SC132GS:
pops = kdev_sensor_sc132gs_get_ops();
break;

View File

@ -77,7 +77,8 @@
#define SENSOR_ID_HMXRICA 2
#define SENSOR_ID_GC2145 3
#define SENSOR_ID_SC132GS 4
#define SENSOR_ID_MAX 5
#define SENSOR_ID_IMX462 5
#define SENSOR_ID_MAX 6
#define SENSOR_ID_EXTERN 0xFE
#define SENSOR_ID_NONE 0xFF
@ -132,16 +133,16 @@
/* original board_kl520_96.h*/
#define IMGSRC_IN_0 YES
#define IMGSRC_IN_1 YES
#define IMGSRC_IN_1 NO
#if (IMGSRC_IN_0 == YES)
#define IMGSRC_IN_0_PORT IMGSRC_IN_PORT_MIPI
#define IMGSRC_0_SENSORID SENSOR_ID_GC2145
#define IMGSRC_0_FORMAT IMG_FORMAT_RGB565
#define IMGSRC_0_SENSORID SENSOR_ID_IMX462// SENSOR_ID_GC2145
#define IMGSRC_0_FORMAT IMG_FORMAT_YCBCR
#define IMGSRC_0_TYPE IMG_TYPE_RGB
#define IMGSRC_0_RES SENSOR_RES_640_480
#define IMGSRC_0_WIDTH 640
#define IMGSRC_0_HEIGHT 480
#define IMGSRC_0_WIDTH 1920//640
#define IMGSRC_0_HEIGHT 1080//480
#define IMGSRC_0_TILE_AVG 0
#define IMGSRC_0_MIPI_LANE 2
#else
@ -222,12 +223,12 @@
#define PANEL_TYPE PANEL_MZT_480X272
#define DISPLAY_DEVICE DISPLAY_DEVICE_LCDC
#define CAM_CLK_MS 2
#define CAM_CLK_NS 242
#define CAM_CLK_MS 1
#define CAM_CLK_NS 99
#define CAM_CLK_PS 2
#define CSI0_TXESC 4
#define CSI0_CSI 11
#define CSI0_VC0 5
#define CSI0_TXESC 3
#define CSI0_CSI 7
#define CSI0_VC0 3
#define CSI1_TXESC 4
#define CSI1_CSI 7
#define CSI1_VC0 1

View File

@ -86,6 +86,8 @@ Head Block of The File
#if (IMGSRC_0_SENSORID == SENSOR_ID_HMX2056) || (IMGSRC_0_SENSORID == SENSOR_ID_SC132GS)
#define D2A_REG_CTRL_0 0x3000
#elif(IMGSRC_0_SENSORID == SENSOR_ID_IMX462)
#define D2A_REG_CTRL_0 0x5000
#elif(IMGSRC_0_SENSORID == SENSOR_ID_OV9286) || (IMGSRC_0_SENSORID == SENSOR_ID_HMXRICA)
#define D2A_REG_CTRL_0 0x3008
#elif(IMGSRC_0_SENSORID == SENSOR_ID_GC2145)
@ -98,6 +100,8 @@ Head Block of The File
#if (IMGSRC_1_SENSORID == SENSOR_ID_HMX2056) || (IMGSRC_1_SENSORID == SENSOR_ID_SC132GS)
#define D2A_REG_CTRL_1 0x3000
#elif(IMGSRC_1_SENSORID == SENSOR_ID_IMX462)
#define D2A_REG_CTRL_1 0x5000
#elif(IMGSRC_1_SENSORID == SENSOR_ID_OV9286) || (IMGSRC_1_SENSORID == SENSOR_ID_HMXRICA)
#define D2A_REG_CTRL_1 0x3008
#elif(IMGSRC_1_SENSORID == SENSOR_ID_GC2145)
@ -276,7 +280,7 @@ void kdrv_dpi2ahb_irqhandler(uint32_t d2a_idx)
if (ctx->page_done_num != sta_st) // 1: page 1 done 2: page 0 done
{
D2APageAddr = (sta_st == BIT0)? &d2a_base->dw.D2APage0Addr: &d2a_base->dw.D2APage1Addr;
// hardware ping-pong buffers mechanism
if (skip_next_count[d2a_idx] <= 0)
{
@ -296,6 +300,11 @@ void kdrv_dpi2ahb_irqhandler(uint32_t d2a_idx)
{
// kmdw_printf("%d: cam %d error D2A_INT_AHB_TX_ERR\n", ++err_cnt, d2a_idx);
// skip what ?
// // 寫入 1 觸發 D2A 硬體軟體重置 (Software Reset)
// d2a_base->dw.D2ACtrl |= 0x1;
// // 輪詢等待硬體重置完成並自動清零
// while (d2a_base->dw.D2ACtrl & 0x1);
}
if (sta_is & D2A_INT_FIFO_UF)

View File

@ -273,6 +273,10 @@ kdrv_status_t kdrv_csi2rx_enable(uint32_t input_type, uint32_t cam_idx, uint32_t
val = 245;
outw(csirx_base + CSI2RX_REG_PFTR , val);
break;
case SENSOR_ID_IMX462:
val = 0;
outw(csirx_base + CSI2RX_REG_PFTR , val);
break;
case SENSOR_ID_GC2145:
CSIRX_REG_VSCR_SET_VSTU0(csirx_base, 1);
break;