mirror of
https://gitee.com/Lyon1998/pikapython.git
synced 2025-01-15 17:02:53 +08:00
update 030 to v1.5.0rc
This commit is contained in:
parent
7b135ec173
commit
4e747a49ed
@ -102,29 +102,17 @@ int main(void) {
|
|||||||
/* boot from flash */
|
/* boot from flash */
|
||||||
pikaMain = newRootObj("pikaMain", New_PikaMain);
|
pikaMain = newRootObj("pikaMain", New_PikaMain);
|
||||||
__pikaMain = pikaMain;
|
__pikaMain = pikaMain;
|
||||||
|
printf("[info]: boot from flash.\r\n");
|
||||||
if (code[0] == 'i') {
|
if (code[0] == 'i') {
|
||||||
printf("[info]: compiling the python...\r\n");
|
obj_run(pikaMain, code);
|
||||||
main_codeBuff = arg_setStr(NULL, "", code);
|
|
||||||
// obj_run(pikaMain, arg_getStr(main_codeBuff));
|
|
||||||
Args* buffs = New_args(NULL);
|
|
||||||
Parser_multiLineToAsm(buffs, arg_getStr(main_codeBuff));
|
|
||||||
NVIC_SystemReset();
|
|
||||||
goto main_loop;
|
goto main_loop;
|
||||||
}
|
}
|
||||||
if (code[0] == 'B') {
|
// if (code[0] == 'B') {
|
||||||
// printf("==============[Pika ASM]==============\r\n");
|
// printf("[info]: asm size: %d\r\n", strGetSize(code));
|
||||||
// for (int i = 0; i < strGetSize(code); i++) {
|
// printf("[info]: boot from Pika Asm.\r\n");
|
||||||
// if ('\n' == code[i]) {
|
// pikaVM_runAsm(pikaMain, code);
|
||||||
// fputc('\r', (FILE*)!NULL);
|
// goto main_loop;
|
||||||
// }
|
// }
|
||||||
// fputc(code[i], (FILE*)!NULL);
|
|
||||||
// }
|
|
||||||
// printf("==============[Pika ASM]==============\r\n");
|
|
||||||
printf("[info]: asm size: %d\r\n", strGetSize(code));
|
|
||||||
printf("[info]: boot from Pika Asm.\r\n");
|
|
||||||
pikaVM_runAsm(pikaMain, code);
|
|
||||||
goto main_loop;
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
/* boot from firmware */
|
/* boot from firmware */
|
||||||
printf("[info]: boot from firmware.\r\n");
|
printf("[info]: boot from firmware.\r\n");
|
||||||
|
@ -164,12 +164,12 @@ uint32_t flash_write_char(uint32_t bassAddr,
|
|||||||
return flash_addr;
|
return flash_addr;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t __platform_Asm_is_to_flash(char* pyMultiLine) {
|
//uint8_t __platform_Asm_is_to_flash(char* pyMultiLine) {
|
||||||
if (strCountSign(pyMultiLine, '\n') > 10) {
|
//// if (strCountSign(pyMultiLine, '\n') > 10) {
|
||||||
return 1;
|
//// return 1;
|
||||||
}
|
//// }
|
||||||
return 0;
|
// return 0;
|
||||||
}
|
//}
|
||||||
|
|
||||||
int32_t __saveStrToFlash(char* str,
|
int32_t __saveStrToFlash(char* str,
|
||||||
uint32_t flashStart,
|
uint32_t flashStart,
|
||||||
@ -183,20 +183,20 @@ int32_t __saveStrToFlash(char* str,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
char* __platform_load_pikaAsm() {
|
//char* __platform_load_pikaAsm() {
|
||||||
return (char*)FLASH_PIKA_ASM_START_ADDR;
|
// return (char*)FLASH_PIKA_ASM_START_ADDR;
|
||||||
}
|
//}
|
||||||
|
|
||||||
int32_t __platform_save_pikaAsm(char* PikaAsm) {
|
//int32_t __platform_save_pikaAsm(char* PikaAsm) {
|
||||||
if (0 == globalWriteAddress) {
|
// if (0 == globalWriteAddress) {
|
||||||
__eriseSelecttedFlash(FLASH_PIKA_ASM_START_ADDR,
|
// __eriseSelecttedFlash(FLASH_PIKA_ASM_START_ADDR,
|
||||||
FLASH_PIKA_ASM_END_ADDR);
|
// FLASH_PIKA_ASM_END_ADDR);
|
||||||
}
|
// }
|
||||||
return __saveStrToFlash(PikaAsm, FLASH_PIKA_ASM_START_ADDR,
|
// return __saveStrToFlash(PikaAsm, FLASH_PIKA_ASM_START_ADDR,
|
||||||
FLASH_PIKA_ASM_END_ADDR, &globalWriteAddress);
|
// FLASH_PIKA_ASM_END_ADDR, &globalWriteAddress);
|
||||||
}
|
//}
|
||||||
|
|
||||||
int32_t __platform_save_pikaAsm_EOF() {
|
int32_t __save_pikaAsm_EOF() {
|
||||||
for (int i = 0; i < 16; i++) {
|
for (int i = 0; i < 16; i++) {
|
||||||
globalWriteAddress = flash_write_char(FLASH_PIKA_ASM_START_ADDR,
|
globalWriteAddress = flash_write_char(FLASH_PIKA_ASM_START_ADDR,
|
||||||
globalWriteAddress, '\0');
|
globalWriteAddress, '\0');
|
||||||
@ -336,7 +336,7 @@ void STM32_Code_flashHandler(void) {
|
|||||||
/* write EOF */
|
/* write EOF */
|
||||||
__saveStrToFlash("\n\n", FLASH_PIKA_ASM_START_ADDR,
|
__saveStrToFlash("\n\n", FLASH_PIKA_ASM_START_ADDR,
|
||||||
FLASH_PIKA_ASM_END_ADDR, &globalWriteAddress);
|
FLASH_PIKA_ASM_END_ADDR, &globalWriteAddress);
|
||||||
__platform_save_pikaAsm_EOF();
|
__save_pikaAsm_EOF();
|
||||||
HAL_FLASH_Lock();
|
HAL_FLASH_Lock();
|
||||||
|
|
||||||
printf("[ OK ]: Write flash ok! \r\n");
|
printf("[ OK ]: Write flash ok! \r\n");
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
<TargetCommonOption>
|
<TargetCommonOption>
|
||||||
<Device>STM32G030C8Tx</Device>
|
<Device>STM32G030C8Tx</Device>
|
||||||
<Vendor>STMicroelectronics</Vendor>
|
<Vendor>STMicroelectronics</Vendor>
|
||||||
<PackID>Keil.STM32G0xx_DFP.1.4.0</PackID>
|
<PackID>Keil.STM32G0xx_DFP.1.3.0</PackID>
|
||||||
<PackURL>http://www.keil.com/pack/</PackURL>
|
<PackURL>http://www.keil.com/pack/</PackURL>
|
||||||
<Cpu>IRAM(0x20000000-0x20001FFF) IROM(0x8000000-0x800FFFF) CLOCK(8000000) CPUTYPE("Cortex-M0+") TZ</Cpu>
|
<Cpu>IRAM(0x20000000-0x20001FFF) IROM(0x8000000-0x800FFFF) CLOCK(8000000) CPUTYPE("Cortex-M0+") TZ</Cpu>
|
||||||
<FlashUtilSpec></FlashUtilSpec>
|
<FlashUtilSpec></FlashUtilSpec>
|
||||||
@ -706,6 +706,11 @@
|
|||||||
<FileType>1</FileType>
|
<FileType>1</FileType>
|
||||||
<FilePath>..\pikascript\pikascript-api/PikaStdLib-api.c</FilePath>
|
<FilePath>..\pikascript\pikascript-api/PikaStdLib-api.c</FilePath>
|
||||||
</File>
|
</File>
|
||||||
|
<File>
|
||||||
|
<FileName>PikaStdLib_PikaObj-api.c</FileName>
|
||||||
|
<FileType>1</FileType>
|
||||||
|
<FilePath>..\pikascript\pikascript-api/PikaStdLib_PikaObj-api.c</FilePath>
|
||||||
|
</File>
|
||||||
<File>
|
<File>
|
||||||
<FileName>STM32G0_PWM-api.c</FileName>
|
<FileName>STM32G0_PWM-api.c</FileName>
|
||||||
<FileType>1</FileType>
|
<FileType>1</FileType>
|
||||||
@ -726,6 +731,16 @@
|
|||||||
<FileType>1</FileType>
|
<FileType>1</FileType>
|
||||||
<FilePath>..\pikascript\pikascript-api/pikaScript.c</FilePath>
|
<FilePath>..\pikascript\pikascript-api/pikaScript.c</FilePath>
|
||||||
</File>
|
</File>
|
||||||
|
<File>
|
||||||
|
<FileName>machine_PWM-api.c</FileName>
|
||||||
|
<FileType>1</FileType>
|
||||||
|
<FilePath>..\pikascript\pikascript-api/machine_PWM-api.c</FilePath>
|
||||||
|
</File>
|
||||||
|
<File>
|
||||||
|
<FileName>machine_Task-api.c</FileName>
|
||||||
|
<FileType>1</FileType>
|
||||||
|
<FilePath>..\pikascript\pikascript-api/machine_Task-api.c</FilePath>
|
||||||
|
</File>
|
||||||
<File>
|
<File>
|
||||||
<FileName>PikaStdTask_Task-api.c</FileName>
|
<FileName>PikaStdTask_Task-api.c</FileName>
|
||||||
<FileType>1</FileType>
|
<FileType>1</FileType>
|
||||||
@ -761,6 +776,16 @@
|
|||||||
<FileType>1</FileType>
|
<FileType>1</FileType>
|
||||||
<FilePath>..\pikascript\pikascript-api/PikaStdDevice_PWM-api.c</FilePath>
|
<FilePath>..\pikascript\pikascript-api/PikaStdDevice_PWM-api.c</FilePath>
|
||||||
</File>
|
</File>
|
||||||
|
<File>
|
||||||
|
<FileName>machine_GPIO-api.c</FileName>
|
||||||
|
<FileType>1</FileType>
|
||||||
|
<FilePath>..\pikascript\pikascript-api/machine_GPIO-api.c</FilePath>
|
||||||
|
</File>
|
||||||
|
<File>
|
||||||
|
<FileName>machine-api.c</FileName>
|
||||||
|
<FileType>1</FileType>
|
||||||
|
<FilePath>..\pikascript\pikascript-api/machine-api.c</FilePath>
|
||||||
|
</File>
|
||||||
<File>
|
<File>
|
||||||
<FileName>STM32G0_IIC-api.c</FileName>
|
<FileName>STM32G0_IIC-api.c</FileName>
|
||||||
<FileType>1</FileType>
|
<FileType>1</FileType>
|
||||||
@ -786,6 +811,16 @@
|
|||||||
<FileType>1</FileType>
|
<FileType>1</FileType>
|
||||||
<FilePath>..\pikascript\pikascript-api/PikaStdDevice_Time-api.c</FilePath>
|
<FilePath>..\pikascript\pikascript-api/PikaStdDevice_Time-api.c</FilePath>
|
||||||
</File>
|
</File>
|
||||||
|
<File>
|
||||||
|
<FileName>machine_KEY-api.c</FileName>
|
||||||
|
<FileType>1</FileType>
|
||||||
|
<FilePath>..\pikascript\pikascript-api/machine_KEY-api.c</FilePath>
|
||||||
|
</File>
|
||||||
|
<File>
|
||||||
|
<FileName>machine_LCD-api.c</FileName>
|
||||||
|
<FileType>1</FileType>
|
||||||
|
<FilePath>..\pikascript\pikascript-api/machine_LCD-api.c</FilePath>
|
||||||
|
</File>
|
||||||
<File>
|
<File>
|
||||||
<FileName>PikaPiZero-api.c</FileName>
|
<FileName>PikaPiZero-api.c</FileName>
|
||||||
<FileType>1</FileType>
|
<FileType>1</FileType>
|
||||||
@ -811,6 +846,11 @@
|
|||||||
<FileType>1</FileType>
|
<FileType>1</FileType>
|
||||||
<FilePath>..\pikascript\pikascript-api/STM32G0_Time-api.c</FilePath>
|
<FilePath>..\pikascript\pikascript-api/STM32G0_Time-api.c</FilePath>
|
||||||
</File>
|
</File>
|
||||||
|
<File>
|
||||||
|
<FileName>machine_Time-api.c</FileName>
|
||||||
|
<FileType>1</FileType>
|
||||||
|
<FilePath>..\pikascript\pikascript-api/machine_Time-api.c</FilePath>
|
||||||
|
</File>
|
||||||
<File>
|
<File>
|
||||||
<FileName>PikaStdLib_StringObj-api.c</FileName>
|
<FileName>PikaStdLib_StringObj-api.c</FileName>
|
||||||
<FileType>1</FileType>
|
<FileType>1</FileType>
|
||||||
@ -821,11 +861,21 @@
|
|||||||
<FileType>1</FileType>
|
<FileType>1</FileType>
|
||||||
<FilePath>..\pikascript\pikascript-api/PikaPiZero_LCD-api.c</FilePath>
|
<FilePath>..\pikascript\pikascript-api/PikaPiZero_LCD-api.c</FilePath>
|
||||||
</File>
|
</File>
|
||||||
|
<File>
|
||||||
|
<FileName>machine_ADC-api.c</FileName>
|
||||||
|
<FileType>1</FileType>
|
||||||
|
<FilePath>..\pikascript\pikascript-api/machine_ADC-api.c</FilePath>
|
||||||
|
</File>
|
||||||
<File>
|
<File>
|
||||||
<FileName>PikaStdData_String-api.c</FileName>
|
<FileName>PikaStdData_String-api.c</FileName>
|
||||||
<FileType>1</FileType>
|
<FileType>1</FileType>
|
||||||
<FilePath>..\pikascript\pikascript-api/PikaStdData_String-api.c</FilePath>
|
<FilePath>..\pikascript\pikascript-api/PikaStdData_String-api.c</FilePath>
|
||||||
</File>
|
</File>
|
||||||
|
<File>
|
||||||
|
<FileName>machine_Point-api.c</FileName>
|
||||||
|
<FileType>1</FileType>
|
||||||
|
<FilePath>..\pikascript\pikascript-api/machine_Point-api.c</FilePath>
|
||||||
|
</File>
|
||||||
<File>
|
<File>
|
||||||
<FileName>STM32G0_Task-api.c</FileName>
|
<FileName>STM32G0_Task-api.c</FileName>
|
||||||
<FileType>1</FileType>
|
<FileType>1</FileType>
|
||||||
@ -846,6 +896,16 @@
|
|||||||
<FileType>1</FileType>
|
<FileType>1</FileType>
|
||||||
<FilePath>..\pikascript\pikascript-api/PikaStdDevice_ADC-api.c</FilePath>
|
<FilePath>..\pikascript\pikascript-api/PikaStdDevice_ADC-api.c</FilePath>
|
||||||
</File>
|
</File>
|
||||||
|
<File>
|
||||||
|
<FileName>machine_UART-api.c</FileName>
|
||||||
|
<FileType>1</FileType>
|
||||||
|
<FilePath>..\pikascript\pikascript-api/machine_UART-api.c</FilePath>
|
||||||
|
</File>
|
||||||
|
<File>
|
||||||
|
<FileName>machine_RGB-api.c</FileName>
|
||||||
|
<FileType>1</FileType>
|
||||||
|
<FilePath>..\pikascript\pikascript-api/machine_RGB-api.c</FilePath>
|
||||||
|
</File>
|
||||||
<File>
|
<File>
|
||||||
<FileName>PikaPiZero_KEY-api.c</FileName>
|
<FileName>PikaPiZero_KEY-api.c</FileName>
|
||||||
<FileType>1</FileType>
|
<FileType>1</FileType>
|
||||||
@ -856,61 +916,6 @@
|
|||||||
<FileType>1</FileType>
|
<FileType>1</FileType>
|
||||||
<FilePath>..\pikascript\pikascript-api/STM32G0_ADC-api.c</FilePath>
|
<FilePath>..\pikascript\pikascript-api/STM32G0_ADC-api.c</FilePath>
|
||||||
</File>
|
</File>
|
||||||
<File>
|
|
||||||
<FileName>machine_ADC-api.c</FileName>
|
|
||||||
<FileType>1</FileType>
|
|
||||||
<FilePath>..\pikascript\pikascript-api\machine_ADC-api.c</FilePath>
|
|
||||||
</File>
|
|
||||||
<File>
|
|
||||||
<FileName>machine_GPIO-api.c</FileName>
|
|
||||||
<FileType>1</FileType>
|
|
||||||
<FilePath>..\pikascript\pikascript-api\machine_GPIO-api.c</FilePath>
|
|
||||||
</File>
|
|
||||||
<File>
|
|
||||||
<FileName>machine_KEY-api.c</FileName>
|
|
||||||
<FileType>1</FileType>
|
|
||||||
<FilePath>..\pikascript\pikascript-api\machine_KEY-api.c</FilePath>
|
|
||||||
</File>
|
|
||||||
<File>
|
|
||||||
<FileName>machine_LCD-api.c</FileName>
|
|
||||||
<FileType>1</FileType>
|
|
||||||
<FilePath>..\pikascript\pikascript-api\machine_LCD-api.c</FilePath>
|
|
||||||
</File>
|
|
||||||
<File>
|
|
||||||
<FileName>machine_Point-api.c</FileName>
|
|
||||||
<FileType>1</FileType>
|
|
||||||
<FilePath>..\pikascript\pikascript-api\machine_Point-api.c</FilePath>
|
|
||||||
</File>
|
|
||||||
<File>
|
|
||||||
<FileName>machine_PWM-api.c</FileName>
|
|
||||||
<FileType>1</FileType>
|
|
||||||
<FilePath>..\pikascript\pikascript-api\machine_PWM-api.c</FilePath>
|
|
||||||
</File>
|
|
||||||
<File>
|
|
||||||
<FileName>machine_RGB-api.c</FileName>
|
|
||||||
<FileType>1</FileType>
|
|
||||||
<FilePath>..\pikascript\pikascript-api\machine_RGB-api.c</FilePath>
|
|
||||||
</File>
|
|
||||||
<File>
|
|
||||||
<FileName>machine_Task-api.c</FileName>
|
|
||||||
<FileType>1</FileType>
|
|
||||||
<FilePath>..\pikascript\pikascript-api\machine_Task-api.c</FilePath>
|
|
||||||
</File>
|
|
||||||
<File>
|
|
||||||
<FileName>machine_Time-api.c</FileName>
|
|
||||||
<FileType>1</FileType>
|
|
||||||
<FilePath>..\pikascript\pikascript-api\machine_Time-api.c</FilePath>
|
|
||||||
</File>
|
|
||||||
<File>
|
|
||||||
<FileName>machine_UART-api.c</FileName>
|
|
||||||
<FileType>1</FileType>
|
|
||||||
<FilePath>..\pikascript\pikascript-api\machine_UART-api.c</FilePath>
|
|
||||||
</File>
|
|
||||||
<File>
|
|
||||||
<FileName>machine-api.c</FileName>
|
|
||||||
<FileType>1</FileType>
|
|
||||||
<FilePath>..\pikascript\pikascript-api\machine-api.c</FilePath>
|
|
||||||
</File>
|
|
||||||
</Files>
|
</Files>
|
||||||
</Group>
|
</Group>
|
||||||
<Group>
|
<Group>
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
pikascript-core==v1.4.0
|
pikascript-core==v1.5.0rc
|
||||||
PikaStdLib==v1.4.0
|
PikaStdLib==v1.5.0rc
|
||||||
PikaStdDevice==v1.4.3
|
PikaStdDevice==v1.4.3
|
||||||
STM32G0==v1.1.1
|
STM32G0==v1.1.1
|
||||||
PikaPiZero==v1.1.3
|
PikaPiZero==v1.1.3
|
||||||
|
@ -18,6 +18,7 @@ print('mem.now :')
|
|||||||
mem.now()
|
mem.now()
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
|
mem.now()
|
||||||
io1.low()
|
io1.low()
|
||||||
time.sleep_ms(500)
|
time.sleep_ms(500)
|
||||||
io1.high()
|
io1.high()
|
||||||
|
@ -7,8 +7,10 @@ pwm.setPin('PA8')
|
|||||||
pwm.setFrequency(2000)
|
pwm.setFrequency(2000)
|
||||||
pwm.setDuty(0.5)
|
pwm.setDuty(0.5)
|
||||||
pwm.enable()
|
pwm.enable()
|
||||||
|
mem = PikaStdLib.MemChecker()
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
|
mem.now()
|
||||||
time.sleep_ms(500)
|
time.sleep_ms(500)
|
||||||
pwm.setDuty(0.5)
|
pwm.setDuty(0.5)
|
||||||
time.sleep_ms(500)
|
time.sleep_ms(500)
|
||||||
|
@ -20,6 +20,7 @@ mem.max()
|
|||||||
|
|
||||||
def rgb_task():
|
def rgb_task():
|
||||||
rgb.flow()
|
rgb.flow()
|
||||||
|
mem.now()
|
||||||
|
|
||||||
|
|
||||||
def led_task():
|
def led_task():
|
||||||
|
Loading…
x
Reference in New Issue
Block a user