From ba4398b9a0d40b2a0ee8c5caef462469b00a61b0 Mon Sep 17 00:00:00 2001 From: ranchuan Date: Wed, 15 Oct 2025 19:34:08 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BD=BF=E7=94=A8gcc=E7=BC=96=E8=AF=91calendar?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Project/.gitignore => .gitignore | 0 Project_App_Calendar/App_Src/main/global.c | 45 +- Project_App_Calendar/App_Src/main/main_asm.s | 1131 +++++++++--------- Project_App_Calendar/make.py | 288 +++++ 4 files changed, 880 insertions(+), 584 deletions(-) rename Project/.gitignore => .gitignore (100%) create mode 100644 Project_App_Calendar/make.py diff --git a/Project/.gitignore b/.gitignore similarity index 100% rename from Project/.gitignore rename to .gitignore diff --git a/Project_App_Calendar/App_Src/main/global.c b/Project_App_Calendar/App_Src/main/global.c index 0808798..2911e4a 100644 --- a/Project_App_Calendar/App_Src/main/global.c +++ b/Project_App_Calendar/App_Src/main/global.c @@ -16,31 +16,42 @@ static app_struct *g_me; //给const类型变量赋值 -__asm static void save_const(void *const_addr,u32 value) +static void save_const(void *const_addr, u32 value) { - str r1,[r0] - bx lr + __asm__ volatile ( + "str %1, [%0]" + : + : "r" (const_addr), "r" (value) + : "memory" + ); } -__asm void *get_r9(void) +void *get_r9(void) { - mov r0,r9 - bx lr + void *result; + __asm__ volatile ( + "mov %0, r9" + : "=r" (result) + : + : + ); + return result; } -__asm void set_r9(void *r9) +void set_r9(void *r9_val) { - mov r9 ,r0 - bx lr + __asm__ volatile ( + "mov r9, %0" + : + : "r" (r9_val) + : "r9" + ); } - - - void *global_in(void) { - void *t=get_r9(); + void *t=get_r9(); set_r9(g_r9); return t; } @@ -54,15 +65,15 @@ void global_out(void *r9) void global_init(app_struct *me) { void *t=get_r9(); - + //使用函数强行赋值 save_const((void *)&g_r9,(u32)t); g_me=me; - + //这个函数提供给系统调用,用以退出app extern int __app_exit(void *); g_me->exit=__app_exit; - + } //app正在运行 @@ -75,7 +86,7 @@ void global_run_start(void) //app结束运行 void global_run_exit(void) { - if(g_me) + if(g_me) { if(g_me->run_state) g_me->run_state--; } diff --git a/Project_App_Calendar/App_Src/main/main_asm.s b/Project_App_Calendar/App_Src/main/main_asm.s index ad5656e..6587c43 100644 --- a/Project_App_Calendar/App_Src/main/main_asm.s +++ b/Project_App_Calendar/App_Src/main/main_asm.s @@ -1,585 +1,584 @@ - AREA |.text|, CODE, READONLY, ALIGN=2 - THUMB - REQUIRE8 - PRESERVE8 - - - + .syntax unified + .cpu cortex-m4 + .fpu softvfp + .thumb + .text - MACRO - api_item $fun_,$index_ - EXPORT $fun_ -$fun_ PROC + + + + + +.macro api_item fun_,index_ +.global \fun_ +.type \fun_, %function +\fun_: MOV r12, #0x20000000 LDR r12, [r12,#0x8] - LDR r12, [r12,#4*$index_] + LDR r12, [r12,#4*\index_] BX r12 - ENDP - - MEND +.endm + @ 操作系统内核相关api + api_item rt_hw_interrupt_disable,1 @ + api_item rt_hw_interrupt_enable,2 @ + api_item rt_enter_critical,3 @ + api_item rt_exit_critical,4 @ + api_item rt_thread_mdelay,5 @ + api_item rt_thread_create,6 @ + api_item rt_thread_startup,7 @ + api_item rt_thread_delete,8 @ - ; 操作系统内核相关api - api_item rt_hw_interrupt_disable,1 ; - api_item rt_hw_interrupt_enable,2 ; - api_item rt_enter_critical,3 ; - api_item rt_exit_critical,4 ; - api_item rt_thread_mdelay,5 ; - api_item rt_thread_create,6 ; - api_item rt_thread_startup,7 ; - api_item rt_thread_delete,8 ; - - api_item rt_timer_create,9 ; - api_item rt_timer_delete,10 ; - api_item rt_timer_start,11 ; - api_item rt_timer_stop,12 ; - - api_item rt_sem_create,13 ; - api_item rt_sem_delete,14 ; - api_item rt_sem_take,15 ; - api_item rt_sem_release,16 ; - - api_item rt_mutex_create,17 ; - api_item rt_mutex_delete,18 ; - api_item rt_mutex_take,19 ; - api_item rt_mutex_release,20 ; - - api_item rt_event_create,21 ; - api_item rt_event_delete,22 ; - api_item rt_event_send,23 ; - api_item rt_event_recv,24 ; - - api_item rt_mb_create,25 ; - api_item rt_mb_delete,26 ; - api_item rt_mb_send,27 ; - api_item rt_mb_send_wait,28 ; - api_item rt_mb_recv,29 ; - - api_item rt_mq_create,30 ; - api_item rt_mq_delete,31 ; - api_item rt_mq_send,32 ; - api_item rt_mq_urgent,33 ; - api_item rt_mq_recv,34 ; - - - - - - - - ; c语言库相关api - api_item fputc,35 ; - api_item rand,36 ; - api_item calloc,37 ; - api_item free,38 ; - api_item malloc,39 ; - api_item realloc,40 ; - - - - - - - - ; 工具模块相关api - api_item tools_updata_on,41 ; - api_item tools_updata_off,42 ; - - - - - - ; 设置模块相关api - - - - - - - ; soft相关api - api_item uni2utf8_str,43 ; - api_item utf82uni_str,44 ; - api_item gbk2uni_str,45 ; - api_item uni2gbk_str,46 ; - api_item gbk2utf8_str,47 ; - api_item utf82gbk_str,48 ; - - api_item FLASH_ReadData,49 ; - api_item FLASH_WriteData,50 ; - api_item FLASH_EraseOneSector,51 ; - api_item FLASH_EraseAllSector,52 ; - api_item FLASH_GetFlashSize,53 ; - api_item FLASH_CheckErase,54 ; - api_item FLASH_LoopWrite,55 ; - api_item FLASH_AddFile,56 ; - api_item FLASH_ReadFile,57 ; - api_item FLASH_FindFile,58 ; - api_item FLASH_GetUsed,59 ; - api_item FLASH_GetFileNum,60 ; - api_item FLASH_GetFileInfo,61 ; - api_item FLASH_DeleteFile,62 ; - api_item FLASH_SaveFile,63 ; - - api_item SysFile_GetFileByName,64 ; - api_item SysFile_Updata,65 ; - api_item SysFile_UpdataByIrq,66 ; - - api_item date_is_leap_year,67 ; - api_item date_get_month_day_max,68 ; - api_item date_get_week_by_day,69 ; - api_item date_get_year_max,70 ; - api_item date_get_year_min,71 ; - api_item date_get_next_day,72 ; - api_item date_get_last_day,73 ; - api_item date_get_next_n_day,74 ; - api_item date_get_last_n_day,75 ; - api_item date_rtc_get_date,76 ; - api_item date_rtc_get_time,77 ; - api_item date_rtc_set_date,78 ; - api_item date_rtc_set_time,79 ; - - api_item app_run_path,80 ; - api_item app_run,81 ; - api_item appm_find,82 ; - api_item appm_get,83 ; - api_item appm_get_running_num,84 ; - api_item app_exit,85 ; - api_item app_get_name_from_file,86 ; - - api_item mp3_get_support,87 ; - api_item mp3_get_support_name,88 ; - api_item mp3_play_song,89 ; - api_item mp3_get_name,90 ; - api_item mp3_get_artist,91 ; - api_item mp3_get_time,92 ; - api_item mp3_stop,93 ; - api_item mp3_play,94 ; - api_item mp3_suspend,95 ; - api_item mp3_set_vol,96 ; - api_item mp3_add_val,97 ; - api_item mp3_sub_val,98 ; - api_item mp3_get_vol,99 ; - - - - ; GUI相关api - - - - - ;; 以下函数对同一对象只能在同一线程调用 ;; - - api_item QUEUE_Init,100 ; - api_item QUEUE_Delete,101 ; - api_item QUEUE_Out,102 ; - api_item QUEUE_In,103 ; - api_item QUEUE_CheckStart,104 ; - api_item QUEUE_Check,105 ; - - ;; 以下函数线程安全 ;; - - api_item POS_RoundPix,106 ; - api_item POS_InRect,107 ; - api_item POS_RectIntersection,108 ; - api_item POS_RectContain,109 ; - api_item POS_RectSub,110 ; - api_item POS_RectEqual,111 ; - - - - - ;; 以下函数只能在ui线程调用 ;; - - api_item WIN_CreatThread,112 ; - api_item WIN_CreatThreadPro,113 ; - api_item WIN_GetExWorkFunStat,114 ; - api_item WIN_ExWorkFunClear,115 ; - api_item WIN_GetWordData,116 ; - - ;; 以下函数线程安全 ;; - - api_item WIN_DecodeImg,117 ; - - - - - ;; 以下函数线程安全 ;; - - api_item WIN_PlaceExtData,118 ; - api_item WIN_RunInWindow,119 ; - - ;; 以下函数只能在ui线程调用 ;; - - ; WIN_Init, - api_item WIN_GetWinStruct,120 ; - api_item WIN_SetRunCallBack,121 ; - api_item WIN_SetBlockWinReturn,122 ; - api_item WIN_GetBlockWinReturn,123 ; - ;api_item WIN_GetBlockWinNum,124 ; - api_item WIN_GetExtData,124 ; - api_item WIN_RunMsgFunction,125 ; - api_item WIN_GetBaseWindow,126 ; - api_item WIN_GetCurrentWindow,127 ; - api_item WIN_CreatWindow,128 ; - api_item WIN_CreatWindowExt,129 ; - api_item WIN_DeleteWindow,130 ; - api_item WIN_SetAsTopWin,131 ; - api_item WIN_ResetAsTopWin,132 ; - api_item WIN_GetWindowStructById,133 ; - api_item WIN_DelFromChidList,134 ; - api_item WIN_AddToChidList,135 ; - api_item WIN_CheckChidWin,136 ; - api_item WIN_FindTopWinByPos,137 ; - api_item WIN_FindTopWin,138 ; - api_item WIN_SetChidWinTop,139 ; - ;api_item WIN_SetChidWinBottom,140 ; - api_item WIN_GetWinPosOnLcd,140 ; - api_item WIN_FindPrent,141 ; - api_item WIN_SetWinInvalidRect,142 ; - api_item WIN_GetWinInvalidRect,143 ; - api_item WIN_SetWinTitle,144 ; - api_item WIN_GetWinByTitle,145 ; - api_item WIN_FindBlock,146 ; - api_item WIN_SetChildWinkeyShield,147 ; - api_item WIN_PaintBackGround,148 ; - api_item WIN_SetBackPic,149 ; - api_item WIN_SetBackPicPath,150 ; - api_item WIN_SetBackFun,151 ; - api_item WIN_SetColor,152 ; - api_item WIN_SetBkColor,153 ; - api_item WIN_ShowWindow,154 ; - - - - - ;; 以下函数只能在非ui线程调用 ;; - - api_item WIN_StorTouchStruct,155 ; - api_item WIN_StorKeyStruct,156 ; - - ;; 以下函数只能在ui线程调用 ;; - - api_item WIN_ClearKeyQueue,157 ; - api_item WIN_ClearTouchQueue,158 ; - api_item WIN_KeyShieldOn,159 ; - api_item WIN_KeyShieldOff,160 ; - api_item WIN_DefaultMsgLoop,161 ; - api_item WIN_SetMsgLoopCallBack,162 ; - api_item WIN_RunBlock,163 ; - api_item WIN_SendMsg,164 ; - api_item WIN_SendMsgToPrent,165 ; - api_item WIN_ClearMsgQueue,166 ; - api_item WIN_CheckMsg,167 ; - api_item WIN_SendTouchMsg,168 ; - api_item WIN_SendTouchMove,169 ; - api_item WIN_SendKeyMsg,170 ; - api_item WIN_TouchMsgBroad,171 ; - api_item WIN_SetInvalid,172 ; - api_item WIN_SetInvalidWhenTop,173 ; - api_item WIN_SetInvalidRect,174 ; - api_item WIN_SetInvalidRectWhenTop,175 ; - api_item WIN_Move,176 ; - api_item WIN_SetPos,177 ; - api_item WIN_SetSize,178 ; - - - - - ;; 以下函数只能在ui线程调用 ;; - - api_item WIN_CreatTimer,179 ; - api_item WIN_TimerReload,180 ; - api_item WIN_SetTimerCycle,181 ; - api_item WIN_DeleteTimer,182 ; - api_item WIN_WinDeleteTimer,183 ; - ; WIN_TimerWork, - - - - - ;; 以下函数对同一对象只能在同一线程调用 ;; - - api_item WIN_CreatVirtualLcd,184 ; - api_item WIN_DeleteVirtualLcd,185 ; - api_item WIN_LcdSetScreenDis,186 ; - api_item WIN_LcdSetWindow,187 ; - api_item WIN_LcdGetWindowSizeX,188 ; - api_item WIN_LcdGetWindowSizeY,189 ; - api_item WIN_LcdSetLcdColor,190 ; - api_item WIN_LcdSetLcdBkColor,191 ; - api_item WIN_LcdSetLcdColor16,192 ; - api_item WIN_LcdSetLcdBkColor16,193 ; - api_item WIN_LcdGetLcdColor,194 ; - api_item WIN_LcdGetLcdBkColor,195 ; - api_item WIN_LcdGetLcdColor16,196 ; - api_item WIN_LcdGetLcdBkColor16,197 ; - api_item WIN_LcdSetLcdDrawMode,198 ; - api_item WIN_LcdFillRectOff16At,199 ; - api_item WIN_LcdDrawPointSafe,200 ; - api_item WIN_LcdDrawPointSafeColor,201 ; - api_item WIN_LcdDrawPointSafeColorAlpha,202 ; - api_item WIN_LcdFillRectByColor,203 ; - api_item WIN_LcdFillRectByColorAlpha,204 ; - api_item WIN_LcdDrawImag,205 ; - api_item WIN_LcdDrawImagButColor,206 ; - api_item WIN_LcdDrawImagByColor,207 ; - api_item WIN_LcdDrawImagByAlpha,208 ; - api_item WIN_LcdClear,209 ; - api_item WIN_LcdClearRect,210 ; - api_item WIN_LcdGetColors,211 ; - - - - - ;; 以下函数只能在ui线程调用 ;; - - api_item WIN_SetFontSize,212 ; - api_item WIN_SetFontType,213 ; - api_item WIN_GetFontHight,214 ; - api_item WIN_GetFontWidth,215 ; - api_item WIN_SetFontMode,216 ; - - - - - ;; 以下函数只能在ui线程调用 ;; - - api_item WIN_DrawPointSafe,217 ; - api_item WIN_DrawPointNormal,218 ; - api_item WIN_DrawPointColorSafe,219 ; - api_item WIN_DrawPointColorNormal,220 ; - api_item WIN_DrawPointSafeColorAlpha,221 ; - api_item WIN_SetLcdColor,222 ; - api_item WIN_SetLcdBkColor,223 ; - api_item WIN_GetLcdColor16,224 ; - api_item WIN_DrawTxtAt,225 ; - api_item WIN_DrawTxtAtRect,226 ; - api_item WIN_DrawTxtCenterAtRect,227 ; - api_item WIN_DrawTxtHCenterAt,228 ; - api_item WIN_DrawHLine,229 ; - api_item WIN_DrawHLineAlpha,230 ; - api_item WIN_DrawVLine,231 ; - api_item WIN_DrawLine,232 ; - api_item WIN_DrawLines,233 ; - api_item WIN_DrawCircle,234 ; - api_item WIN_DrawRect,235 ; - api_item WIN_DrawPolygon,236 ; - api_item WIN_FillRectByColor,237 ; - api_item WIN_FillRectByColorAlpha,238 ; - api_item WIN_FillTriangle,239 ; - api_item WIN_FillPolygon,240 ; - api_item WIN_CreatPlaneAA,241 ; - api_item WIN_DeletePlaneAA,242 ; - api_item WIN_DrawPointAA,243 ; - api_item WIN_DrawPlaneAA,244 ; - api_item WIN_DrawLineAA,245 ; - api_item WIN_FillRect,246 ; - api_item WIN_FillRectAlpha,247 ; - api_item WIN_DrawImag,248 ; - api_item WIN_DrawImagButColor,249 ; - api_item WIN_DrawImagByColor,250 ; - api_item WIN_DrawImagByAlpha,251 ; - api_item WIN_DrawImagByAlphaAnti,252 ; - api_item WIN_Clear,253 ; - api_item WIN_GetTxtRectSize,254 ; - api_item WIN_GetImageSize,255 ; - - - - - ;; 以下函数只能在ui线程调用 ;; - - api_item WIN_GetPic,256 ; - api_item WIN_GetPicNoAlpha,257 ; - api_item WIN_PicInsidePic,258 ; - api_item WIN_GetPicLive,259 ; - api_item WIN_DrawPic,260 ; - - - - - ;; 以下函数只能在ui线程调用 ;; - - api_item MSGBOX_SetTitle,261 ; - api_item MSGBOX_SetMsg,262 ; - api_item MSGBOX_SetKey,263 ; - api_item MSGBOX_SetKey2,264 ; - api_item MSGBOX_AddItem,265 ; - api_item MSGBOX_Tips,266 ; - api_item MSGBOX_TipsTime,267 ; - api_item MSGBOX_Inquiry,268 ; - api_item MSGBOX_Select,269 ; - - - - - ;; 以下函数只能在ui线程调用 ;; - - api_item WIN_CreatButton,270 ; - api_item BUTTON_SetKeyString,271 ; - - - - - ;; 以下函数只能在ui线程调用 ;; - - api_item WIN_CreatInput,272 ; - api_item INPUT_KeyBoard,273 ; - - - - - ;; 以下函数只能在ui线程调用 ;; - - api_item WIN_CreatList,274 ; - api_item LIST_SetItem,275 ; - api_item LIST_SetItemHeight,276 ; - api_item LIST_SetYOrigin,277 ; - api_item LIST_SetYMove,278 ; - - - - - ;; 以下函数只能在ui线程调用 ;; - - api_item WIN_CreatPage,279 ; - api_item PAGE_SetBackPic,280 ; - api_item PAGE_SetItem,281 ; - api_item PAGE_SetTitleHeight,282 ; - api_item PAGE_SetItemHeight,283 ; - api_item PAGE_SetItemIndent,284 ; - api_item PAGE_IndexAdd,285 ; - api_item PAGE_IndexSub,286 ; - - - - - ;; 以下函数只能在ui线程调用 ;; - - api_item POPUP_SelectItem,287 ; - api_item POPUP_AddItem,288 ; - - - - - ;; 以下函数只能在ui线程调用 ;; - - api_item WORKING_DoWork,289 ; - - - - - ;; 以下函数只能在ui线程调用 ;; - - api_item SCROLLBAR_SelectItem,290 ; - api_item SCROLLBAR_SelectNum,291 ; - api_item SCROLLBAR_AddItem,292 ; - - - - - ;; 以下函数只能在ui线程调用 ;; - - api_item INPUTBOX_InputChars,293 ; - api_item INPUTBOX_Clear,294 ; - api_item INPUTBOX_SetChars,295 ; - - - - - ;; 以下函数只能在ui线程调用 ;; - - api_item RECORD_DrawRecord,296 ; - api_item RECORD_AddMsg,297 ; - - - - - ;; 以下函数只能在ui线程调用 ;; - - api_item WIN_CreatTouch,298 ; - api_item WIN_CreatTouchEx,299 ; - api_item WIN_CreatTouchChild,300 ; - api_item WIN_CreatTouchBase,301 ; - api_item TOUCHWIN_AddChild,302 ; - api_item TOUCHWIN_ClearChild,303 ; - api_item TOUCHWIN_SetOutCon,304 ; - - - - - - - ; 一些补充函数 - api_item myfree,305 ; - api_item mymalloc,306 ; - api_item myrealloc,307 ; - api_item mycalloc,308 ; - api_item mymalloc_fast,309 ; - ;api_item mymalloc_ex,310 ; - ;api_item myfree_ccm,311 ; - ;api_item mymalloc_ccm,312 ; - api_item mymemset ,310 ; - api_item mymemcpy,311 ; - api_item mem_perused,312 ; - api_item exmem_perused,313 ; - ;api_item ccm_perused,314 ; - - - - - - - - - - - ; FATFS文件系统 - api_item f_open,314 ; - api_item f_close,315 ; - api_item f_read,316 ; - api_item f_write,317 ; - api_item f_lseek,318 ; - api_item f_truncate,319 ; - api_item f_sync,320 ; - api_item f_opendir,321 ; - api_item f_closedir,322 ; - api_item f_readdir,323 ; - api_item f_findfirst,324 ; - api_item f_findnext,325 ; - api_item f_mkdir,326 ; - api_item f_unlink,327 ; - api_item f_rename,328 ; - api_item f_stat,329 ; - api_item f_getfree,330 ; - api_item f_mount,331 ; - api_item f_mkfs,332 ; - ;api_item f_chmod,333 ; - ;api_item f_utime,334 ; - ;api_item f_chdir,335 ; - ;api_item f_chdrive,336 ; - ;api_item f_getcwd,337 ; - ;api_item f_getlabel,338 ; - ;api_item f_setlabel,339 ; - ;api_item f_forward,340 ; - ;api_item f_expand,341 ; - ;api_item f_fdisk,342 ; - ;api_item f_setcp,343 ; - ;api_item f_putc,344 ; - ;api_item f_puts,345 ; - ;api_item f_printf,346 ; - ;api_item f_gets,347 ; + api_item rt_timer_create,9 @ + api_item rt_timer_delete,10 @ + api_item rt_timer_start,11 @ + api_item rt_timer_stop,12 @ + api_item rt_sem_create,13 @ + api_item rt_sem_delete,14 @ + api_item rt_sem_take,15 @ + api_item rt_sem_release,16 @ + api_item rt_mutex_create,17 @ + api_item rt_mutex_delete,18 @ + api_item rt_mutex_take,19 @ + api_item rt_mutex_release,20 @ + + api_item rt_event_create,21 @ + api_item rt_event_delete,22 @ + api_item rt_event_send,23 @ + api_item rt_event_recv,24 @ + + api_item rt_mb_create,25 @ + api_item rt_mb_delete,26 @ + api_item rt_mb_send,27 @ + api_item rt_mb_send_wait,28 @ + api_item rt_mb_recv,29 @ + + api_item rt_mq_create,30 @ + api_item rt_mq_delete,31 @ + api_item rt_mq_send,32 @ + api_item rt_mq_urgent,33 @ + api_item rt_mq_recv,34 @ + + + + + + + + @ c语言库相关api + api_item fputc,35 @ + api_item rand,36 @ + api_item calloc,37 @ + api_item free,38 @ + api_item malloc,39 @ + api_item realloc,40 @ + api_item strlen,500 + api_item sprintf,501 + + + + + + + @ 工具模块相关api + api_item tools_updata_on,41 @ + api_item tools_updata_off,42 @ + + + + + + @ 设置模块相关api + + + + + + + @ soft相关api + api_item uni2utf8_str,43 @ + api_item utf82uni_str,44 @ + api_item gbk2uni_str,45 @ + api_item uni2gbk_str,46 @ + api_item gbk2utf8_str,47 @ + api_item utf82gbk_str,48 @ + + api_item FLASH_ReadData,49 @ + api_item FLASH_WriteData,50 @ + api_item FLASH_EraseOneSector,51 @ + api_item FLASH_EraseAllSector,52 @ + api_item FLASH_GetFlashSize,53 @ + api_item FLASH_CheckErase,54 @ + api_item FLASH_LoopWrite,55 @ + api_item FLASH_AddFile,56 @ + api_item FLASH_ReadFile,57 @ + api_item FLASH_FindFile,58 @ + api_item FLASH_GetUsed,59 @ + api_item FLASH_GetFileNum,60 @ + api_item FLASH_GetFileInfo,61 @ + api_item FLASH_DeleteFile,62 @ + api_item FLASH_SaveFile,63 @ + + api_item SysFile_GetFileByName,64 @ + api_item SysFile_Updata,65 @ + api_item SysFile_UpdataByIrq,66 @ + + api_item date_is_leap_year,67 @ + api_item date_get_month_day_max,68 @ + api_item date_get_week_by_day,69 @ + api_item date_get_year_max,70 @ + api_item date_get_year_min,71 @ + api_item date_get_next_day,72 @ + api_item date_get_last_day,73 @ + api_item date_get_next_n_day,74 @ + api_item date_get_last_n_day,75 @ + api_item date_rtc_get_date,76 @ + api_item date_rtc_get_time,77 @ + api_item date_rtc_set_date,78 @ + api_item date_rtc_set_time,79 @ + + api_item app_run_path,80 @ + api_item app_run,81 @ + api_item appm_find,82 @ + api_item appm_get,83 @ + api_item appm_get_running_num,84 @ + api_item app_exit,85 @ + api_item app_get_name_from_file,86 @ + + api_item mp3_get_support,87 @ + api_item mp3_get_support_name,88 @ + api_item mp3_play_song,89 @ + api_item mp3_get_name,90 @ + api_item mp3_get_artist,91 @ + api_item mp3_get_time,92 @ + api_item mp3_stop,93 @ + api_item mp3_play,94 @ + api_item mp3_suspend,95 @ + api_item mp3_set_vol,96 @ + api_item mp3_add_val,97 @ + api_item mp3_sub_val,98 @ + api_item mp3_get_vol,99 @ + + + + @ GUI相关api + + + + + @@ 以下函数对同一对象只能在同一线程调用 @@ + + api_item QUEUE_Init,100 @ + api_item QUEUE_Delete,101 @ + api_item QUEUE_Out,102 @ + api_item QUEUE_In,103 @ + api_item QUEUE_CheckStart,104 @ + api_item QUEUE_Check,105 @ + + @@ 以下函数线程安全 @@ + + api_item POS_RoundPix,106 @ + api_item POS_InRect,107 @ + api_item POS_RectIntersection,108 @ + api_item POS_RectContain,109 @ + api_item POS_RectSub,110 @ + api_item POS_RectEqual,111 @ + + + + + @@ 以下函数只能在ui线程调用 @@ + + api_item WIN_CreatThread,112 @ + api_item WIN_CreatThreadPro,113 @ + api_item WIN_GetExWorkFunStat,114 @ + api_item WIN_ExWorkFunClear,115 @ + api_item WIN_GetWordData,116 @ + + @@ 以下函数线程安全 @@ + + api_item WIN_DecodeImg,117 @ + + + + + @@ 以下函数线程安全 @@ + + api_item WIN_PlaceExtData,118 @ + api_item WIN_RunInWindow,119 @ + + @@ 以下函数只能在ui线程调用 @@ + + @ WIN_Init, + api_item WIN_GetWinStruct,120 @ + api_item WIN_SetRunCallBack,121 @ + api_item WIN_SetBlockWinReturn,122 @ + api_item WIN_GetBlockWinReturn,123 @ + @api_item WIN_GetBlockWinNum,124 @ + api_item WIN_GetExtData,124 @ + api_item WIN_RunMsgFunction,125 @ + api_item WIN_GetBaseWindow,126 @ + api_item WIN_GetCurrentWindow,127 @ + api_item WIN_CreatWindow,128 @ + api_item WIN_CreatWindowExt,129 @ + api_item WIN_DeleteWindow,130 @ + api_item WIN_SetAsTopWin,131 @ + api_item WIN_ResetAsTopWin,132 @ + api_item WIN_GetWindowStructById,133 @ + api_item WIN_DelFromChidList,134 @ + api_item WIN_AddToChidList,135 @ + api_item WIN_CheckChidWin,136 @ + api_item WIN_FindTopWinByPos,137 @ + api_item WIN_FindTopWin,138 @ + api_item WIN_SetChidWinTop,139 @ + @api_item WIN_SetChidWinBottom,140 @ + api_item WIN_GetWinPosOnLcd,140 @ + api_item WIN_FindPrent,141 @ + api_item WIN_SetWinInvalidRect,142 @ + api_item WIN_GetWinInvalidRect,143 @ + api_item WIN_SetWinTitle,144 @ + api_item WIN_GetWinByTitle,145 @ + api_item WIN_FindBlock,146 @ + api_item WIN_SetChildWinkeyShield,147 @ + api_item WIN_PaintBackGround,148 @ + api_item WIN_SetBackPic,149 @ + api_item WIN_SetBackPicPath,150 @ + api_item WIN_SetBackFun,151 @ + api_item WIN_SetColor,152 @ + api_item WIN_SetBkColor,153 @ + api_item WIN_ShowWindow,154 @ + + + + + @@ 以下函数只能在非ui线程调用 @@ + + api_item WIN_StorTouchStruct,155 @ + api_item WIN_StorKeyStruct,156 @ + + @@ 以下函数只能在ui线程调用 @@ + + api_item WIN_ClearKeyQueue,157 @ + api_item WIN_ClearTouchQueue,158 @ + api_item WIN_KeyShieldOn,159 @ + api_item WIN_KeyShieldOff,160 @ + api_item WIN_DefaultMsgLoop,161 @ + api_item WIN_SetMsgLoopCallBack,162 @ + api_item WIN_RunBlock,163 @ + api_item WIN_SendMsg,164 @ + api_item WIN_SendMsgToPrent,165 @ + api_item WIN_ClearMsgQueue,166 @ + api_item WIN_CheckMsg,167 @ + api_item WIN_SendTouchMsg,168 @ + api_item WIN_SendTouchMove,169 @ + api_item WIN_SendKeyMsg,170 @ + api_item WIN_TouchMsgBroad,171 @ + api_item WIN_SetInvalid,172 @ + api_item WIN_SetInvalidWhenTop,173 @ + api_item WIN_SetInvalidRect,174 @ + api_item WIN_SetInvalidRectWhenTop,175 @ + api_item WIN_Move,176 @ + api_item WIN_SetPos,177 @ + api_item WIN_SetSize,178 @ + + + + + @@ 以下函数只能在ui线程调用 @@ + + api_item WIN_CreatTimer,179 @ + api_item WIN_TimerReload,180 @ + api_item WIN_SetTimerCycle,181 @ + api_item WIN_DeleteTimer,182 @ + api_item WIN_WinDeleteTimer,183 @ + @ WIN_TimerWork, + + + + + @@ 以下函数对同一对象只能在同一线程调用 @@ + + api_item WIN_CreatVirtualLcd,184 @ + api_item WIN_DeleteVirtualLcd,185 @ + api_item WIN_LcdSetScreenDis,186 @ + api_item WIN_LcdSetWindow,187 @ + api_item WIN_LcdGetWindowSizeX,188 @ + api_item WIN_LcdGetWindowSizeY,189 @ + api_item WIN_LcdSetLcdColor,190 @ + api_item WIN_LcdSetLcdBkColor,191 @ + api_item WIN_LcdSetLcdColor16,192 @ + api_item WIN_LcdSetLcdBkColor16,193 @ + api_item WIN_LcdGetLcdColor,194 @ + api_item WIN_LcdGetLcdBkColor,195 @ + api_item WIN_LcdGetLcdColor16,196 @ + api_item WIN_LcdGetLcdBkColor16,197 @ + api_item WIN_LcdSetLcdDrawMode,198 @ + api_item WIN_LcdFillRectOff16At,199 @ + api_item WIN_LcdDrawPointSafe,200 @ + api_item WIN_LcdDrawPointSafeColor,201 @ + api_item WIN_LcdDrawPointSafeColorAlpha,202 @ + api_item WIN_LcdFillRectByColor,203 @ + api_item WIN_LcdFillRectByColorAlpha,204 @ + api_item WIN_LcdDrawImag,205 @ + api_item WIN_LcdDrawImagButColor,206 @ + api_item WIN_LcdDrawImagByColor,207 @ + api_item WIN_LcdDrawImagByAlpha,208 @ + api_item WIN_LcdClear,209 @ + api_item WIN_LcdClearRect,210 @ + api_item WIN_LcdGetColors,211 @ + + + + + @@ 以下函数只能在ui线程调用 @@ + + api_item WIN_SetFontSize,212 @ + api_item WIN_SetFontType,213 @ + api_item WIN_GetFontHight,214 @ + api_item WIN_GetFontWidth,215 @ + api_item WIN_SetFontMode,216 @ + + + + + @@ 以下函数只能在ui线程调用 @@ + + api_item WIN_DrawPointSafe,217 @ + api_item WIN_DrawPointNormal,218 @ + api_item WIN_DrawPointColorSafe,219 @ + api_item WIN_DrawPointColorNormal,220 @ + api_item WIN_DrawPointSafeColorAlpha,221 @ + api_item WIN_SetLcdColor,222 @ + api_item WIN_SetLcdBkColor,223 @ + api_item WIN_GetLcdColor16,224 @ + api_item WIN_DrawTxtAt,225 @ + api_item WIN_DrawTxtAtRect,226 @ + api_item WIN_DrawTxtCenterAtRect,227 @ + api_item WIN_DrawTxtHCenterAt,228 @ + api_item WIN_DrawHLine,229 @ + api_item WIN_DrawHLineAlpha,230 @ + api_item WIN_DrawVLine,231 @ + api_item WIN_DrawLine,232 @ + api_item WIN_DrawLines,233 @ + api_item WIN_DrawCircle,234 @ + api_item WIN_DrawRect,235 @ + api_item WIN_DrawPolygon,236 @ + api_item WIN_FillRectByColor,237 @ + api_item WIN_FillRectByColorAlpha,238 @ + api_item WIN_FillTriangle,239 @ + api_item WIN_FillPolygon,240 @ + api_item WIN_CreatPlaneAA,241 @ + api_item WIN_DeletePlaneAA,242 @ + api_item WIN_DrawPointAA,243 @ + api_item WIN_DrawPlaneAA,244 @ + api_item WIN_DrawLineAA,245 @ + api_item WIN_FillRect,246 @ + api_item WIN_FillRectAlpha,247 @ + api_item WIN_DrawImag,248 @ + api_item WIN_DrawImagButColor,249 @ + api_item WIN_DrawImagByColor,250 @ + api_item WIN_DrawImagByAlpha,251 @ + api_item WIN_DrawImagByAlphaAnti,252 @ + api_item WIN_Clear,253 @ + api_item WIN_GetTxtRectSize,254 @ + api_item WIN_GetImageSize,255 @ + + + + + @@ 以下函数只能在ui线程调用 @@ + + api_item WIN_GetPic,256 @ + api_item WIN_GetPicNoAlpha,257 @ + api_item WIN_PicInsidePic,258 @ + api_item WIN_GetPicLive,259 @ + api_item WIN_DrawPic,260 @ + + + + + @@ 以下函数只能在ui线程调用 @@ + + api_item MSGBOX_SetTitle,261 @ + api_item MSGBOX_SetMsg,262 @ + api_item MSGBOX_SetKey,263 @ + api_item MSGBOX_SetKey2,264 @ + api_item MSGBOX_AddItem,265 @ + api_item MSGBOX_Tips,266 @ + api_item MSGBOX_TipsTime,267 @ + api_item MSGBOX_Inquiry,268 @ + api_item MSGBOX_Select,269 @ + + + + + @@ 以下函数只能在ui线程调用 @@ + + api_item WIN_CreatButton,270 @ + api_item BUTTON_SetKeyString,271 @ + + + + + @@ 以下函数只能在ui线程调用 @@ + + api_item WIN_CreatInput,272 @ + api_item INPUT_KeyBoard,273 @ + + + + + @@ 以下函数只能在ui线程调用 @@ + + api_item WIN_CreatList,274 @ + api_item LIST_SetItem,275 @ + api_item LIST_SetItemHeight,276 @ + api_item LIST_SetYOrigin,277 @ + api_item LIST_SetYMove,278 @ + + + + + @@ 以下函数只能在ui线程调用 @@ + + api_item WIN_CreatPage,279 @ + api_item PAGE_SetBackPic,280 @ + api_item PAGE_SetItem,281 @ + api_item PAGE_SetTitleHeight,282 @ + api_item PAGE_SetItemHeight,283 @ + api_item PAGE_SetItemIndent,284 @ + api_item PAGE_IndexAdd,285 @ + api_item PAGE_IndexSub,286 @ + + + + + @@ 以下函数只能在ui线程调用 @@ + + api_item POPUP_SelectItem,287 @ + api_item POPUP_AddItem,288 @ + + + + + @@ 以下函数只能在ui线程调用 @@ + + api_item WORKING_DoWork,289 @ + + + + + @@ 以下函数只能在ui线程调用 @@ + + api_item SCROLLBAR_SelectItem,290 @ + api_item SCROLLBAR_SelectNum,291 @ + api_item SCROLLBAR_AddItem,292 @ + + + + + @@ 以下函数只能在ui线程调用 @@ + + api_item INPUTBOX_InputChars,293 @ + api_item INPUTBOX_Clear,294 @ + api_item INPUTBOX_SetChars,295 @ + + + + + @@ 以下函数只能在ui线程调用 @@ + + api_item RECORD_DrawRecord,296 @ + api_item RECORD_AddMsg,297 @ + + + + + @@ 以下函数只能在ui线程调用 @@ + + api_item WIN_CreatTouch,298 @ + api_item WIN_CreatTouchEx,299 @ + api_item WIN_CreatTouchChild,300 @ + api_item WIN_CreatTouchBase,301 @ + api_item TOUCHWIN_AddChild,302 @ + api_item TOUCHWIN_ClearChild,303 @ + api_item TOUCHWIN_SetOutCon,304 @ + + + + + + + @ 一些补充函数 + api_item myfree,305 @ + api_item mymalloc,306 @ + api_item myrealloc,307 @ + api_item mycalloc,308 @ + api_item mymalloc_fast,309 @ + @api_item mymalloc_ex,310 @ + @api_item myfree_ccm,311 @ + @api_item mymalloc_ccm,312 @ + api_item mymemset ,310 @ + api_item mymemcpy,311 @ + api_item mem_perused,312 @ + api_item exmem_perused,313 @ + @api_item ccm_perused,314 @ + + + + + + + + + + + @ FATFS文件系统 + api_item f_open,314 @ + api_item f_close,315 @ + api_item f_read,316 @ + api_item f_write,317 @ + api_item f_lseek,318 @ + api_item f_truncate,319 @ + api_item f_sync,320 @ + api_item f_opendir,321 @ + api_item f_closedir,322 @ + api_item f_readdir,323 @ + api_item f_findfirst,324 @ + api_item f_findnext,325 @ + api_item f_mkdir,326 @ + api_item f_unlink,327 @ + api_item f_rename,328 @ + api_item f_stat,329 @ + api_item f_getfree,330 @ + api_item f_mount,331 @ + api_item f_mkfs,332 @ + @api_item f_chmod,333 @ + @api_item f_utime,334 @ + @api_item f_chdir,335 @ + @api_item f_chdrive,336 @ + @api_item f_getcwd,337 @ + @api_item f_getlabel,338 @ + @api_item f_setlabel,339 @ + @api_item f_forward,340 @ + @api_item f_expand,341 @ + @api_item f_fdisk,342 @ + @api_item f_setcp,343 @ + @api_item f_putc,344 @ + @api_item f_puts,345 @ + @api_item f_printf,346 @ + @api_item f_gets,347 @ @@ -591,9 +590,7 @@ $fun_ PROC - ALIGN 4 - END diff --git a/Project_App_Calendar/make.py b/Project_App_Calendar/make.py new file mode 100644 index 0000000..fd98acb --- /dev/null +++ b/Project_App_Calendar/make.py @@ -0,0 +1,288 @@ +import os +import sys +import time +import shutil +import dataclasses +import subprocess +from pathlib import Path +from multiprocessing import Process,Queue,Value,cpu_count + + +os.environ["PATH"]+=";D:/Program Files/arm-gnu-toolchain/bin" +os.environ["LANG"]="zh_CN.GBK" + +CC="arm-none-eabi-gcc" +AS = CC + ' -x assembler-with-cpp' +OBJCPY="arm-none-eabi-objcopy" +OBJDUMP="arm-none-eabi-objdump" +SIZE="arm-none-eabi-size" + +CFLAG=[ + '-mcpu=cortex-m4', + '-mthumb', + '-mfpu=fpv4-sp-d16', + '-mfloat-abi=hard', + '-O3', + '-Wall', + '-fdata-sections', + '-ffunction-sections', + + # debug + '-g -gdwarf-2', + '-fpic', + '-e my_main -Wl,--section-start=.app_info=0x00000000 -nostartfiles -nodefaultlibs' +] + +DEF=[ + '-DUSE_STDPERIPH_DRIVER', + '-DSTM32F429_439xx', + '-DARM_MATH_CM4', + '-D__FPU_PRESENT=1', + # '-D__GNUC__', + '-D__packed=__attribute__((__packed__))', + '-D__weak=__attribute__((weak))', + '-D__RTTHREAD__', + # 浣跨敤usb鏃舵墦寮杩欎釜瀹 绯荤粺鏃堕挓浼氳璁剧疆涓168MHz USB鏃堕挓涓48MHz + # 濡傛灉涓嶆墦寮杩欎釜瀹 绯荤粺鏃堕挓浼氳璁剧疆涓180MHz USB浼氶氫俊寮傚父 + '-D__USB_USB__', +] + +INC=[ + '-IApp_Src/drive', + '-IApp_Src/main', + '-IApp_Src/main/inc/MyWinCore', + '-IApp_Src/main/inc/software', + '-IApp_Src/main/inc/Window', + '-IApp_Src/win' +] + +SRC_DIR=[ +] + +SRC=[ + 'App_Src/main/main.c', + 'App_Src/main/global.c', + 'App_Src/main/main_asm.s', + 'App_Src/win/mywin_user_calendar.c', +] + + +TARGET="stm32" + +OUTPUT="output" + + +# 鎵惧埌鐩綍涓嬬殑鎵鏈夋寚瀹氱被鍨嬬殑鏂囦欢 +def find_type(path: str, fix: str): + root = Path(path) + file_list=[] + for file in root.rglob(f"*{fix}"): + if file.is_file(): + file_list.append(f"{file}") + return file_list + + +def tran_path(path:str): + path=os.path.normpath(os.path.join(OUTPUT,path)) + base_path=os.path.dirname(path) + if not os.path.exists(base_path): + os.makedirs(base_path) + return path + + +# 鍒ゆ柇鏄惁闇瑕侀噸鏂扮敓鎴 +def check_rebuild(dst:str,src:list): + if(not os.path.exists(dst)): + return True + dst_time=os.path.getmtime(dst) + src_time=[] + for i in src: + src_time.append(os.path.getmtime(i)) + src_time.sort() + if(src_time[-1]>dst_time): + return True + return False + + + +# 璇诲彇.d鏂囦欢锛岃繑鍥炰緷璧栨枃浠跺垪琛 +def read_depend_files(name:str): + with open(name) as f: + lines=f.readlines() + t='' + for line in lines: + line=line.strip() + if(line[-1]=='\\'): + t+=line[:-1] + else: + t+=line + t=t.split(':')[-1].strip() + t=t.split(' ') + return t + + +@dataclasses.dataclass +class cmd_item_t: + cmd:str + info:str + +def run_cmd(cmd_queue:Queue,cpu_index:int,return_list:Queue,failed_num): + ack=True + while(not cmd_queue.empty()): + if(failed_num.value>0): + break + try: + cmd=cmd_queue.get_nowait() + except Exception: + break + print(f"[{cpu_index}] {cmd.info}") + # ret=os.system(cmd.cmd) + try: + ret = subprocess.run(cmd.cmd, shell=True, timeout=60).returncode + except subprocess.TimeoutExpired: + print("鍛戒护鎵ц瓒呮椂锛") + failed_num.value += 1 + ret = -1 + if(ret!=0): + print(f"[{cpu_index}] ret={ret}") + ack=False + failed_num.value+=1 + break + return_list.put((cpu_index,ack)) + + +def run_cmd_queue(cmd_queue:Queue,cpu_num:int=8): + if(cmd_queue.empty()): + return True + process_list = [] + return_list=Queue() + failed_num=Value('i',0) + for i in range(cpu_num): + p = Process(target=run_cmd,args=(cmd_queue,i,return_list,failed_num,)) + p.daemon=True + p.start() + process_list.append(p) + for i in process_list: + i.join() + ret=True + while not return_list.empty(): + i=return_list.get() + if(not i[1]): + ret=False + print(f"瀛愯繘绋 [{i[0]}] 杩愯澶辫触") + return_list.cancel_join_thread() + # 娑堣楁帀鎵鏈夋暟鎹槻姝㈣繘绋嬫棤娉曢鍑 + while not cmd_queue.empty(): + cmd_queue.get() + cmd_queue.cancel_join_thread() + return ret + + +# 淇濊瘉鐩爣閮藉瓨鍦 +def check_exists(src:list): + for item in src: + for i in range(10): + if(os.path.exists(item)): + break + time.sleep(0.1) +# 鐢熸垚渚濊禆鍏崇郴 +def build_depend(src:list): + CmdQueue=Queue() + dst_list=[] + flags=f"{' '.join(INC)} {' '.join(DEF)} {' '.join(CFLAG)}" + for i in src: + name_t=os.path.splitext(tran_path(i)) + name=name_t[0] + file_type=name_t[-1] + if(not file_type in ['.c','.C','.cpp']): + continue + dst='.'.join([name,'d']) + if(check_rebuild(dst,[i])): + cmd=f"{CC} -MM {i} -o {dst} {flags}" + CmdQueue.put(cmd_item_t(cmd,f"鏇存柊 {dst}")) + dst_list.append(dst) + return run_cmd_queue(CmdQueue) + +# 鐢熸垚涓棿鏂囦欢 +def build_object(src:list): + CmdQueue=Queue() + dst_list=[] + flags=f"{' '.join(INC)} {' '.join(DEF)} {' '.join(CFLAG)}" + for i in src: + name_t=os.path.splitext(tran_path(i)) + name=name_t[0] + file_type=name_t[-1] + dst='.'.join([name,'o']) + cd='.'.join([name,'d']) + cmd = '' + if(file_type in ['.c','.C']): + if(check_rebuild(dst,read_depend_files(cd))): + cmd=f"{CC} -c {i} -o {dst} {flags}" + elif(file_type in ['.s','.S','.asm','.ASM']): + if(check_rebuild(dst,[i])): + cmd=f"{AS} -c {i} -o {dst} {flags}" + cmd+=f"&& {OBJDUMP} -D {dst} > {dst}.lst" + if(len(cmd)>0): + CmdQueue.put(cmd_item_t(cmd,f"缂栬瘧 {dst}")) + dst_list.append(dst) + return run_cmd_queue(CmdQueue) + + +# 鐢熸垚鍙墽琛屾枃浠 +def build_target(src:list): + flags=f"{' '.join(INC)} {' '.join(DEF)} {' '.join(CFLAG)}" + obj_list=[] + for i in src: + name=os.path.splitext(tran_path(i))[0] + obj_list.append('.'.join([name,'o'])) + dst=os.path.join(OUTPUT,TARGET)+".elf" + if(check_rebuild(dst,obj_list)): + rsp=f"{' '.join(obj_list)} -o {dst} {flags} \ + -Wl,-Map={OUTPUT}/{TARGET}.map,--cref -Wl,--gc-sections \ + -Wl,-print-memory-usage" + print(f"閾炬帴 {dst}") + with open(f"{OUTPUT}/{TARGET}.rsp",'w+') as f: + f.write(rsp.replace('\\','/')) + ret=os.system(f"{CC} @{OUTPUT}/{TARGET}.rsp") + return ret==0 + return False + + + +def main(): + global SRC + + if not os.path.exists(OUTPUT): + os.mkdir(OUTPUT) + + for item in SRC_DIR: + SRC += find_type(item,'.c') + + if len(sys.argv) > 1: + l=[] + if sys.argv[1] == 'show_inc': + l=INC + elif sys.argv[1] == 'show_src': + l=SRC + l.sort() + for item in l: + t=item.replace('\\','/') + print(f"\"Project/{t}\",") + return + + if build_depend(SRC): + if build_object(SRC): + if build_target(SRC): + os.system(f"{OBJCPY} -O binary -S {OUTPUT}/{TARGET}.elf {OUTPUT}/{TARGET}.bin") + os.system(f"{OBJCPY} -O ihex {OUTPUT}/{TARGET}.elf {OUTPUT}/{TARGET}.hex") + os.system(f"{OBJDUMP} -D {OUTPUT}/{TARGET}.elf > {OUTPUT}/{TARGET}.lst") + + + +if __name__ == "__main__": + tick_start=time.time() + main() + tick_end=time.time() + print(f"cost: {tick_end-tick_start}") + # for item in find_type('Src/zlib',".c"): + # print(f"'{item}',".replace('\\','/'))