mirror of
https://gitee.com/Lyon1998/pikapython.git
synced 2025-01-15 17:02:53 +08:00
96 lines
3.3 KiB
C
96 lines
3.3 KiB
C
/*********************************************************************************************************************
|
||
* COPYRIGHT NOTICE
|
||
* Copyright (c) 2020,<2C><><EFBFBD>ɿƼ<C9BF>
|
||
* All rights reserved.
|
||
* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>QQȺ<51><C8BA><EFBFBD><EFBFBD>Ⱥ<EFBFBD><C8BA>824575535
|
||
*
|
||
* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݰ<EFBFBD>Ȩ<EFBFBD><C8A8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɿƼ<C9BF><C6BC><EFBFBD><EFBFBD>У<EFBFBD>δ<EFBFBD><CEB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ҵ<EFBFBD><D2B5>;<EFBFBD><CDBE>
|
||
* <20><>ӭ<EFBFBD><D3AD>λʹ<CEBB>ò<EFBFBD><C3B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><DEB8><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD>뱣<EFBFBD><EBB1A3><EFBFBD><EFBFBD><EFBFBD>ɿƼ<C9BF><C6BC>İ<EFBFBD>Ȩ<EFBFBD><C8A8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
*
|
||
* @file main
|
||
* @company <09>ɶ<EFBFBD><C9B6><EFBFBD><EFBFBD>ɿƼ<C9BF><C6BC><EFBFBD><EFBFBD><EFBFBD>˾
|
||
* @author <09><><EFBFBD>ɿƼ<C9BF>(QQ3184284598)
|
||
* @version <09>鿴doc<6F><63>version<6F>ļ<EFBFBD> <20>汾˵<E6B1BE><CBB5>
|
||
* @Software ADS v1.2.2
|
||
* @Target core TC264D
|
||
* @Taobao https://seekfree.taobao.com/
|
||
* @date 2020-3-23
|
||
********************************************************************************************************************/
|
||
|
||
|
||
#include "headfile.h"
|
||
#include "pikascript.h"
|
||
#pragma section all "cpu0_dsram"
|
||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>#pragma section all restore<72><65><EFBFBD><EFBFBD>֮<EFBFBD><D6AE><EFBFBD><EFBFBD>ȫ<EFBFBD>ֱ<EFBFBD><D6B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>CPU0<55><30>RAM<41><4D>
|
||
|
||
|
||
//<2F><><EFBFBD>̵<EFBFBD><CCB5>뵽<EFBFBD><EBB5BD><EFBFBD><EFBFBD>֮<EFBFBD><D6AE><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6>ѡ<EFBFBD>й<EFBFBD><D0B9><EFBFBD>Ȼ<EFBFBD><C8BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>refreshˢ<68><CBA2>һ<EFBFBD><D2BB>֮<EFBFBD><D6AE><EFBFBD>ٱ<EFBFBD><D9B1><EFBFBD>
|
||
//<2F><><EFBFBD><EFBFBD>Ĭ<EFBFBD><C4AC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD>ر<EFBFBD><D8B1>Ż<EFBFBD><C5BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Լ<EFBFBD><D4BC>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1>properties->C/C++ Build->Setting
|
||
//Ȼ<><C8BB><EFBFBD><EFBFBD><EFBFBD>Ҳ<EFBFBD><D2B2>Ĵ<EFBFBD><C4B4><EFB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<CEBA><CEB5>жϣ<D0B6><CFA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD>Լ<EFBFBD><D4BC>ֶ<EFBFBD><D6B6><EFBFBD><EFBFBD><EFBFBD>enableInterrupts();<3B><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>жϵ<D0B6><CFB5><EFBFBD>Ӧ<EFBFBD><D3A6>
|
||
|
||
uint8 uart_buff;
|
||
|
||
int core0_main(void)
|
||
{
|
||
get_clk();//<2F><>ȡʱ<C8A1><CAB1>Ƶ<EFBFBD><C6B5> <20><><EFBFBD>ر<EFBFBD><D8B1><EFBFBD>
|
||
//<2F>û<EFBFBD><C3BB>ڴ˴<DAB4><CBB4><EFBFBD><EFBFBD>ø<EFBFBD><C3B8>ֳ<EFBFBD>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
uart_init(UART_0, 115200, UART0_TX_P14_0, UART0_RX_P14_1);
|
||
enableInterrupts();
|
||
uart_putstr(UART_0, "\n---uart test---\n");
|
||
gpio_init(P20_8, GPO, 0, PUSHPULL);
|
||
//<2F>ڱ<EFBFBD><DAB1><EFBFBD><EFBFBD>У<EFBFBD><D0A3><EFBFBD><EFBFBD>ڴ<EFBFBD><DAB4>ڵĽ<DAB5><C4BD><EFBFBD><EFBFBD>뷢<EFBFBD>Ͷ<EFBFBD><CDB6><EFBFBD>ͨ<EFBFBD><CDA8><EFBFBD>ж<EFBFBD><D0B6><EFBFBD><EFBFBD>ɵģ<C9B5><C4A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʹ<EFBFBD>ô<EFBFBD><C3B4>ڹ<EFBFBD><DAB9><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ر<EFBFBD>֤<EFBFBD>ж<EFBFBD><D0B6>ǿ<EFBFBD><C7BF><EFBFBD><EFBFBD>ģ<EFBFBD>Ҳ<EFBFBD><D2B2><EFBFBD>ǵ<EFBFBD><C7B5><EFBFBD><EFBFBD><EFBFBD>enableInterrupts()
|
||
//<2F><><EFBFBD>ڵ<EFBFBD><DAB5>жϺ<D0B6><CFBA><EFBFBD>ȫ<EFBFBD><C8AB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>isr.c<>С<EFBFBD>
|
||
|
||
//<2F><><EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD><D0B6><EFBFBD><EFBFBD>ص<EFBFBD><D8B5><EFBFBD><EFBFBD>ò<EFBFBD><C3B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>isr_config.h<><68>
|
||
//<2F><><EFBFBD><EFBFBD><EFBFBD>ò<EFBFBD><C3B2><EFBFBD><EFBFBD><EFBFBD> ERU_CH0_CH4_INT_SERVICE <20><> ERU_CH0_CH4_INT_PRIO
|
||
//UART0_INT_SERVICE <20>жϷ<D0B6><CFB7><EFBFBD><EFBFBD>ߣ<EFBFBD><DFA3><EFBFBD>ʾ<EFBFBD><CABE><EFBFBD>ж<EFBFBD><D0B6><EFBFBD>˭<EFBFBD><CBAD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>0:CPU0 1:CPU1 3:DMA <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD>ֵ
|
||
//UART0_TX_INT_PRIO <20><><EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD><D0B6><EFBFBD><EFBFBD>ȼ<EFBFBD> <20><><EFBFBD>ȼ<EFBFBD><C8BC><EFBFBD>Χ1-255 Խ<><D4BD><EFBFBD><EFBFBD><EFBFBD>ȼ<EFBFBD>Խ<EFBFBD><D4BD> <20><>ƽʱʹ<CAB1>õĵ<C3B5>Ƭ<EFBFBD><C6AC><EFBFBD><EFBFBD>һ<EFBFBD><D2BB>
|
||
//UART0_RX_INT_PRIO <09><><EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD><D0B6><EFBFBD><EFBFBD>ȼ<EFBFBD>
|
||
//UART0_ER_INT_PRIO <20><><EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD><D0B6><EFBFBD><EFBFBD>ȼ<EFBFBD>
|
||
|
||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>жϲ<D0B6><CFB2><EFBFBD>ͬ<EFBFBD><CDAC>
|
||
|
||
//<2F><>Ҫ<EFBFBD>ر<EFBFBD>ע<EFBFBD><D7A2><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȼ<EFBFBD><C8BC><EFBFBD>ͬ<EFBFBD><CDAC><EFBFBD>жϺ<D0B6><CFBA><EFBFBD> ÿ<><C3BF><EFBFBD>жϵ<D0B6><CFB5><EFBFBD><EFBFBD>ȼ<EFBFBD><C8BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Dz<EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD>
|
||
|
||
//<2F>ȴ<EFBFBD><C8B4><EFBFBD><EFBFBD>к<EFBFBD><D0BA>ij<EFBFBD>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
IfxCpu_emitEvent(&g_cpuSyncEvent);
|
||
IfxCpu_waitEvent(&g_cpuSyncEvent, 0xFFFF);
|
||
enableInterrupts();
|
||
// PikaObj* pikaMain = pikaScriptInit();
|
||
pikaScriptShell(pikaScriptInit());
|
||
//ע<><D7A2> <20><>V1.1.6<EFBFBD>汾֮<EFBFBD><EFBFBD> printf<74><66>ӡ<EFBFBD><D3A1><EFBFBD><EFBFBD>Ϣ<EFBFBD>Ӵ<EFBFBD><D3B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѧϰ<D1A7><CFB0><EFBFBD><EFBFBD><EFBFBD><EFBFBD>6-Printf_Demo
|
||
//ע<><D7A2> <20><>V1.1.6<EFBFBD>汾֮<EFBFBD><EFBFBD> printf<74><66>ӡ<EFBFBD><D3A1><EFBFBD><EFBFBD>Ϣ<EFBFBD>Ӵ<EFBFBD><D3B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѧϰ<D1A7><CFB0><EFBFBD><EFBFBD><EFBFBD><EFBFBD>6-Printf_Demo
|
||
//ע<><D7A2> <20><>V1.1.6<EFBFBD>汾֮<EFBFBD><EFBFBD> printf<74><66>ӡ<EFBFBD><D3A1><EFBFBD><EFBFBD>Ϣ<EFBFBD>Ӵ<EFBFBD><D3B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѧϰ<D1A7><CFB0><EFBFBD><EFBFBD><EFBFBD><EFBFBD>6-Printf_Demo
|
||
while (TRUE)
|
||
{
|
||
//<2F><>ѯ<EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݣ<EFBFBD><DDA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
if(uart_query(UART_0, &uart_buff))
|
||
{
|
||
//<2F><><EFBFBD>յ<EFBFBD><D5B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݣ<EFBFBD><DDA3>ٷ<EFBFBD><D9B7><EFBFBD>ȥ
|
||
uart_putchar(UART_0, uart_buff);
|
||
gpio_toggle(P20_8);
|
||
}
|
||
|
||
//ʹ<><CAB9>usbתttl<74><6C><EFBFBD>ӵ<EFBFBD>Ƭ<EFBFBD><C6AC><EFBFBD>Ĵ<EFBFBD><C4B4>ڣ<EFBFBD><DAA3>ڵ<EFBFBD><DAB5><EFBFBD><EFBFBD>ϴ<CFB4><F2BFAAB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>֣<EFBFBD><D6A3><EFBFBD><EFBFBD>ⷢ<EFBFBD><E2B7A2><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD>
|
||
//<2F><>Ƭ<EFBFBD><C6AC><EFBFBD>յ<EFBFBD><D5B5><EFBFBD><EFBFBD>᷵<EFBFBD>ط<EFBFBD><D8B7>͵<EFBFBD><CDB5>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>־ͻ<D6BE><CDBB><EFBFBD>ʾ<EFBFBD>ղŷ<D5B2><C5B7>͵Ķ<CDB5><C4B6><EFBFBD>
|
||
}
|
||
}
|
||
|
||
char __platform_getchar()
|
||
{
|
||
while(TRUE){
|
||
if(uart_query(UART_0, &uart_buff))
|
||
{
|
||
return uart_buff;
|
||
}
|
||
}
|
||
}
|
||
|
||
#pragma section all restore
|
||
|
||
|