support print to debug in pico

This commit is contained in:
pikastech 2022-01-05 10:17:07 +08:00
parent b3918c6f38
commit 5de559e817
29 changed files with 1914 additions and 370 deletions

View File

@ -1,43 +1,5 @@
SET PATH=C:\Keil_v5\ARM\ARMCLANG\Bin;C:\Keil_v5\ARM\AC6.17\Bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files\Git\cmd;C:\Program Files (x86)\GNU Arm Embedded Toolchain\10 2021.10\bin;C:\Users\liang\AppData\Local\Programs\Python\Python310\Scripts\;C:\Users\liang\AppData\Local\Programs\Python\Python310\;C:\Users\liang\AppData\Local\Microsoft\WindowsApps;C:\Users\liang\AppData\Local\Programs\Microsoft VS Code\bin
SET PATH=C:\Keil_v5\ARM\ARMCLANG\Bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files\Git\cmd;C:\Program Files\dotnet\;C:\Program Files\PuTTY\;C:\Program Files (x86)\GNU Arm Embedded Toolchain\10 2021.10\bin;C:\Users\liang\AppData\Local\Programs\Python\Python310\Scripts\;C:\Users\liang\AppData\Local\Programs\Python\Python310\;C:\Users\liang\AppData\Local\Microsoft\WindowsApps;C:\Users\liang\AppData\Local\Programs\Microsoft VS Code\bin;C:\texlive\2021\bin\win32;C:\Users\liang\.dotnet\tools
SET CPU_TYPE=ARMCM0P_MPU
SET CPU_VENDOR=ARM
SET UV2_TARGET=AC6-flash
SET CPU_CLOCK=0x00B71B00
"C:\Keil_v5\ARM\ARMCLANG\Bin\ArmClang.exe" @".\objects\startup_rp2040.__i"
"C:\Keil_v5\ARM\ARMCLANG\Bin\ArmClang.exe" @".\objects\system_rp2040.__i"
"C:\Keil_v5\ARM\ARMCLANG\Bin\ArmClang.exe" @".\objects\clocks.__i"
"C:\Keil_v5\ARM\ARMCLANG\Bin\ArmClang.exe" @".\objects\watchdog.__i"
"C:\Keil_v5\ARM\ARMCLANG\Bin\ArmClang.exe" @".\objects\pll.__i"
"C:\Keil_v5\ARM\ARMCLANG\Bin\ArmClang.exe" @".\objects\platform.__i"
"C:\Keil_v5\ARM\ARMCLANG\Bin\ArmClang.exe" @".\objects\xosc.__i"
"C:\Keil_v5\ARM\ARMCLANG\Bin\ArmClang.exe" @".\objects\irq.__i"
"C:\Keil_v5\ARM\ARMCLANG\Bin\ArmClang.exe" @".\objects\irq_handler_chain._ac"
"C:\Keil_v5\ARM\ARMCLANG\Bin\ArmClang.exe" @".\objects\gpio.__i"
"C:\Keil_v5\ARM\ARMCLANG\Bin\ArmClang.exe" @".\objects\multicore.__i"
"C:\Keil_v5\ARM\ARMCLANG\Bin\ArmClang.exe" @".\objects\sync.__i"
"C:\Keil_v5\ARM\ARMCLANG\Bin\ArmClang.exe" @".\objects\critical_section.__i"
"C:\Keil_v5\ARM\ARMCLANG\Bin\ArmClang.exe" @".\objects\lock_core.__i"
"C:\Keil_v5\ARM\ARMCLANG\Bin\ArmClang.exe" @".\objects\mutex.__i"
"C:\Keil_v5\ARM\ARMCLANG\Bin\ArmClang.exe" @".\objects\sem.__i"
"C:\Keil_v5\ARM\ARMCLANG\Bin\ArmClang.exe" @".\objects\time.__i"
"C:\Keil_v5\ARM\ARMCLANG\Bin\ArmClang.exe" @".\objects\timeout_helper.__i"
"C:\Keil_v5\ARM\ARMCLANG\Bin\ArmClang.exe" @".\objects\timer.__i"
"C:\Keil_v5\ARM\ARMCLANG\Bin\ArmClang.exe" @".\objects\claim.__i"
"C:\Keil_v5\ARM\ARMCLANG\Bin\ArmClang.exe" @".\objects\queue.__i"
"C:\Keil_v5\ARM\ARMCLANG\Bin\ArmClang.exe" @".\objects\pheap.__i"
"C:\Keil_v5\ARM\ARMCLANG\Bin\ArmClang.exe" @".\objects\datetime.__i"
"C:\Keil_v5\ARM\ARMCLANG\Bin\ArmClang.exe" @".\objects\stdlib.__i"
"C:\Keil_v5\ARM\ARMCLANG\Bin\ArmClang.exe" @".\objects\uart.__i"
"C:\Keil_v5\ARM\ARMCLANG\Bin\ArmClang.exe" @".\objects\compile_time_choice._ac"
"C:\Keil_v5\ARM\ARMCLANG\Bin\ArmClang.exe" @".\objects\runtime.__i"
"C:\Keil_v5\ARM\ARMCLANG\Bin\ArmClang.exe" @".\objects\i2c.__i"
"C:\Keil_v5\ARM\ARMCLANG\Bin\ArmClang.exe" @".\objects\spi.__i"
"C:\Keil_v5\ARM\ARMCLANG\Bin\ArmClang.exe" @".\objects\adc.__i"
"C:\Keil_v5\ARM\ARMCLANG\Bin\ArmClang.exe" @".\objects\bootrom.__i"
"C:\Keil_v5\ARM\ARMCLANG\Bin\ArmClang.exe" @".\objects\stdio.__i"
"C:\Keil_v5\ARM\ARMCLANG\Bin\ArmClang.exe" @".\objects\stdio_uart.__i"
"C:\Keil_v5\ARM\ARMCLANG\Bin\ArmClang.exe" @".\objects\env_wrapper.__i"
"C:\Keil_v5\ARM\ARMCLANG\Bin\ArmClang.exe" @".\objects\main.__i"
"C:\Keil_v5\ARM\ARMCLANG\Bin\ArmClang.exe" @".\objects\retarget_io.__i"
"C:\Keil_v5\ARM\ARMCLANG\Bin\ArmLink" --Via ".\Objects\template.lnp"
.\axf2uf2.bat

View File

@ -77,6 +77,7 @@ LR_IROM1 0x20000000 SRAM_SIZE { ; load region size_region
RW_IRAM_UNINIT +0 UNINIT {
*(.uninitialized_data*)
*(.bss.noinit)
}

View File

@ -26,9 +26,9 @@ FUNC void debug_from_ram(void)
_WWORD(0x40058028 ,Reset_Handler | 0x01); //! scratch 7
exec("RESET");
exec("G, Reset_Handler");
//exec("BS main");
//exec("G, Reset_Handler");
exec("G, main");
}
DEFINE BUTTON "Reset Pico", "debug_from_ram()"

View File

@ -3,7 +3,7 @@
<package schemaVersion="1.4" xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:noNamespaceSchemaLocation="PACK.xsd">
<vendor>GorgonMeducer</vendor>
<name>perf_counter</name>
<description>A dedicated performance counter for Cortex-M systick. It shares the SysTick with users' original SysTick function without interfere it. This library will bring new functionalities, such as performance counter, delay_us and clock() service defined in time.h</description>
<description>A dedicated performance counter for the Cortex-M Systick. It shares the SysTick with users' original SysTick function without interfering with it. This library will bring new functionalities, such as performance counter, delay_us and clock() service defined in time.h</description>
<url>https://raw.githubusercontent.com/GorgonMeducer/perf_counter/CMSIS-Pack/cmsis-pack/</url>
<supportContact>https://github.com/GorgonMeducer/perf_counter/issues</supportContact>
<license>lib/LICENSE</license>
@ -16,6 +16,14 @@
<repository type="git">https://github.com/GorgonMeducer/perf_counter.git</repository>
<releases>
<release date="2021-12-22" version="1.7.1" url="https://raw.githubusercontent.com/GorgonMeducer/perf_counter/CMSIS-Pack/cmsis-pack/GorgonMeducer.perf_counter.1.7.1.pack">
- Add support for FreeRTOS
- Other minor update
</release>
<release date="2021-12-20" version="1.7.0" url="https://raw.githubusercontent.com/GorgonMeducer/perf_counter/CMSIS-Pack/cmsis-pack/GorgonMeducer.perf_counter.1.7.0.pack">
- Add new feature for RTOS. Now you can get cycle information for the current thread.
- Other minor update
</release>
<release date="2021-12-05" version="1.6.5" url="https://raw.githubusercontent.com/GorgonMeducer/perf_counter/CMSIS-Pack/cmsis-pack/GorgonMeducer.perf_counter.1.6.5.pack">
- Include stddef.h in perf_counter.h to solve missing NULL definition issue.
</release>
@ -77,6 +85,18 @@
<require Cclass="CMSIS" Cgroup="CORE"/>
</condition>
<condition id="RTX5 Patch">
<description>Require RTX5 Support</description>
<accept Cclass="CMSIS" Cgroup="RTOS2" Csub="Keil RTX5" Cvariant="Source"/>
<require Cclass="Utilities" Cgroup="perf_counter" Csub="Core"/>
</condition>
<condition id="FreeRTOS Patch">
<description>Require FreeRTOS Support</description>
<accept Cbundle="FreeRTOS" Cclass="RTOS" Cversion="10.3.1"/>
<require Cclass="Utilities" Cgroup="perf_counter" Csub="Core"/>
</condition>
<condition id="Cortex-M Arm GCC">
<description>Compile Cortex-M Processors with GNU Tools for Arm Embedded Processors.</description>
<require condition="Arm GCC"/>
@ -101,6 +121,7 @@
<require condition="CMSIS-CORE"/>
</condition>
</conditions>
<!-- apis section (optional - for Application Programming Interface descriptions) -->
<!--
@ -133,23 +154,67 @@
-->
<components>
<component Cclass="Utilities" Cgroup="Performance" Csub="perf_counter" Cvariant="Library" Cversion="1.6.5" isDefaultVariant="true">
<description>A dedicated performance counter for Cortex-M systick.</description>
<files>
<file category="header" name="lib/perf_counter.h"/>
<file category="library" name="lib/perf_counter.lib" condition="Cortex-M Arm Compiler"/>
<file category="library" name="lib/libperf_counter_gcc.a" condition="Cortex-M Arm GCC"/>
</files>
</component>
<component Cclass="Utilities" Cgroup="Performance" Csub="perf_counter" Cvariant="Source" Cversion="1.6.5" condition="CMSIS-CORE">
<description>A dedicated performance counter for Cortex-M systick.</description>
<files>
<file category="header" name="lib/perf_counter.h"/>
<file category="source" name="perf_counter.c" />
<file category="source" name="systick_wrapper_ual.s" condition="Cortex-M Arm Compiler CMSIS-CORE"/>
<file category="source" name="systick_wrapper_gcc.s" condition="Cortex-M Arm GCC CMSIS-CORE"/>
</files>
</component>
<bundle Cbundle="Performance Counter" Cclass="Utilities" Cversion="1.7.1">
<description>A dedicated performance counter for Cortex-M systick.</description>
<doc></doc>
<component Cgroup="perf_counter" Csub="Core" Cvariant="Library" isDefaultVariant="true">
<description>A dedicated performance counter for Cortex-M systick.</description>
<files>
<file category="header" name="lib/perf_counter.h"/>
<file category="library" name="lib/perf_counter.lib" condition="Cortex-M Arm Compiler"/>
<file category="library" name="lib/libperf_counter_gcc.a" condition="Cortex-M Arm GCC"/>
</files>
</component>
<component Cgroup="perf_counter" Csub="Core" Cvariant="Source" condition="CMSIS-CORE">
<description>A dedicated performance counter for Cortex-M systick.</description>
<files>
<file category="header" name="lib/perf_counter.h"/>
<file category="source" name="perf_counter.c" />
<file category="source" name="systick_wrapper_ual.s" condition="Cortex-M Arm Compiler CMSIS-CORE"/>
<file category="source" name="systick_wrapper_gcc.s" condition="Cortex-M Arm GCC CMSIS-CORE"/>
</files>
</component>
<component Cgroup="perf_counter" Csub="RTX5 Patch" condition="RTX5 Patch">
<description>A Patch for RTX5</description>
<files>
<file category="source" name="lib/perf_os_patch_rtx5.c"/>
</files>
<Pre_Include_Global_h>
//! \brief Enable RTOS Patch for perf_counter
#define __PERF_CNT_USE_RTOS__
</Pre_Include_Global_h>
</component>
<component Cgroup="perf_counter" Csub="FreeRTOS Patch" condition="FreeRTOS Patch">
<description>A Patch for FreeRTOS</description>
<files>
<file category="source" name="lib/perf_os_patch_freertos.c"/>
</files>
<Pre_Include_Global_h>
//! \brief Enable RTOS Patch for perf_counter
#define __PERF_CNT_USE_RTOS__
</Pre_Include_Global_h>
<RTE_Components_h>
#define traceTASK_SWITCHED_OUT_DISABLE
#define traceTASK_SWITCHED_IN_DISABLE
#if defined(MPU_WRAPPERS_INCLUDED_FROM_API_FILE)
extern void __freertos_evr_on_task_switched_out (void *ptTCB);
extern void __freertos_evr_on_task_switched_in(void *ptTCB, uint32_t uxTopPriority) ;
# define traceTASK_SWITCHED_OUT() \
__freertos_evr_on_task_switched_out(pxCurrentTCB)
# define traceTASK_SWITCHED_IN() \
__freertos_evr_on_task_switched_in(pxCurrentTCB, uxTopReadyPriority)
#endif
</RTE_Components_h>
</component>
</bundle>
</components>
<!-- optional taxonomy section for defining new component Class and Group names -->

View File

@ -1,2 +1,2 @@
# perf_counter
A dedicated performance counter for Cortex-M systick. It shares the SysTick with users' original SysTick function without interfere it. This library will bring new functionalities, such as performance counter, delay_us and clock() service defined in time.h
A dedicated performance counter for Cortex-M systick. It shares the SysTick with users' original SysTick function without interfering with it. This library will bring new functionalities, such as performance counter, delay_us and clock() service defined in time.h.

View File

@ -3,7 +3,7 @@
<package schemaVersion="1.4" xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:noNamespaceSchemaLocation="PACK.xsd">
<vendor>GorgonMeducer</vendor>
<name>perf_counter</name>
<description>A dedicated performance counter for Cortex-M systick. It shares the SysTick with users' original SysTick function without interfere it. This library will bring new functionalities, such as performance counter, delay_us and clock() service defined in time.h</description>
<description>A dedicated performance counter for the Cortex-M Systick. It shares the SysTick with users' original SysTick function without interfering with it. This library will bring new functionalities, such as performance counter, delay_us and clock() service defined in time.h</description>
<url>https://raw.githubusercontent.com/GorgonMeducer/perf_counter/CMSIS-Pack/cmsis-pack/</url>
<supportContact>https://github.com/GorgonMeducer/perf_counter/issues</supportContact>
<license>lib/LICENSE</license>
@ -16,6 +16,14 @@
<repository type="git">https://github.com/GorgonMeducer/perf_counter.git</repository>
<releases>
<release date="2021-12-22" version="1.7.1" url="https://raw.githubusercontent.com/GorgonMeducer/perf_counter/CMSIS-Pack/cmsis-pack/GorgonMeducer.perf_counter.1.7.1.pack">
- Add support for FreeRTOS
- Other minor update
</release>
<release date="2021-12-20" version="1.7.0" url="https://raw.githubusercontent.com/GorgonMeducer/perf_counter/CMSIS-Pack/cmsis-pack/GorgonMeducer.perf_counter.1.7.0.pack">
- Add new feature for RTOS. Now you can get cycle information for the current thread.
- Other minor update
</release>
<release date="2021-12-05" version="1.6.5" url="https://raw.githubusercontent.com/GorgonMeducer/perf_counter/CMSIS-Pack/cmsis-pack/GorgonMeducer.perf_counter.1.6.5.pack">
- Include stddef.h in perf_counter.h to solve missing NULL definition issue.
</release>
@ -77,6 +85,18 @@
<require Cclass="CMSIS" Cgroup="CORE"/>
</condition>
<condition id="RTX5 Patch">
<description>Require RTX5 Support</description>
<accept Cclass="CMSIS" Cgroup="RTOS2" Csub="Keil RTX5" Cvariant="Source"/>
<require Cclass="Utilities" Cgroup="perf_counter" Csub="Core"/>
</condition>
<condition id="FreeRTOS Patch">
<description>Require FreeRTOS Support</description>
<accept Cbundle="FreeRTOS" Cclass="RTOS" Cversion="10.3.1"/>
<require Cclass="Utilities" Cgroup="perf_counter" Csub="Core"/>
</condition>
<condition id="Cortex-M Arm GCC">
<description>Compile Cortex-M Processors with GNU Tools for Arm Embedded Processors.</description>
<require condition="Arm GCC"/>
@ -101,6 +121,7 @@
<require condition="CMSIS-CORE"/>
</condition>
</conditions>
<!-- apis section (optional - for Application Programming Interface descriptions) -->
<!--
@ -133,23 +154,67 @@
-->
<components>
<component Cclass="Utilities" Cgroup="Performance" Csub="perf_counter" Cvariant="Library" Cversion="1.6.5" isDefaultVariant="true">
<description>A dedicated performance counter for Cortex-M systick.</description>
<files>
<file category="header" name="lib/perf_counter.h"/>
<file category="library" name="lib/perf_counter.lib" condition="Cortex-M Arm Compiler"/>
<file category="library" name="lib/libperf_counter_gcc.a" condition="Cortex-M Arm GCC"/>
</files>
</component>
<component Cclass="Utilities" Cgroup="Performance" Csub="perf_counter" Cvariant="Source" Cversion="1.6.5" condition="CMSIS-CORE">
<description>A dedicated performance counter for Cortex-M systick.</description>
<files>
<file category="header" name="lib/perf_counter.h"/>
<file category="source" name="perf_counter.c" />
<file category="source" name="systick_wrapper_ual.s" condition="Cortex-M Arm Compiler CMSIS-CORE"/>
<file category="source" name="systick_wrapper_gcc.s" condition="Cortex-M Arm GCC CMSIS-CORE"/>
</files>
</component>
<bundle Cbundle="Performance Counter" Cclass="Utilities" Cversion="1.7.1">
<description>A dedicated performance counter for Cortex-M systick.</description>
<doc></doc>
<component Cgroup="perf_counter" Csub="Core" Cvariant="Library" isDefaultVariant="true">
<description>A dedicated performance counter for Cortex-M systick.</description>
<files>
<file category="header" name="lib/perf_counter.h"/>
<file category="library" name="lib/perf_counter.lib" condition="Cortex-M Arm Compiler"/>
<file category="library" name="lib/libperf_counter_gcc.a" condition="Cortex-M Arm GCC"/>
</files>
</component>
<component Cgroup="perf_counter" Csub="Core" Cvariant="Source" condition="CMSIS-CORE">
<description>A dedicated performance counter for Cortex-M systick.</description>
<files>
<file category="header" name="lib/perf_counter.h"/>
<file category="source" name="perf_counter.c" />
<file category="source" name="systick_wrapper_ual.s" condition="Cortex-M Arm Compiler CMSIS-CORE"/>
<file category="source" name="systick_wrapper_gcc.s" condition="Cortex-M Arm GCC CMSIS-CORE"/>
</files>
</component>
<component Cgroup="perf_counter" Csub="RTX5 Patch" condition="RTX5 Patch">
<description>A Patch for RTX5</description>
<files>
<file category="source" name="lib/perf_os_patch_rtx5.c"/>
</files>
<Pre_Include_Global_h>
//! \brief Enable RTOS Patch for perf_counter
#define __PERF_CNT_USE_RTOS__
</Pre_Include_Global_h>
</component>
<component Cgroup="perf_counter" Csub="FreeRTOS Patch" condition="FreeRTOS Patch">
<description>A Patch for FreeRTOS</description>
<files>
<file category="source" name="lib/perf_os_patch_freertos.c"/>
</files>
<Pre_Include_Global_h>
//! \brief Enable RTOS Patch for perf_counter
#define __PERF_CNT_USE_RTOS__
</Pre_Include_Global_h>
<RTE_Components_h>
#define traceTASK_SWITCHED_OUT_DISABLE
#define traceTASK_SWITCHED_IN_DISABLE
#if defined(MPU_WRAPPERS_INCLUDED_FROM_API_FILE)
extern void __freertos_evr_on_task_switched_out (void *ptTCB);
extern void __freertos_evr_on_task_switched_in(void *ptTCB, uint32_t uxTopPriority) ;
# define traceTASK_SWITCHED_OUT() \
__freertos_evr_on_task_switched_out(pxCurrentTCB)
# define traceTASK_SWITCHED_IN() \
__freertos_evr_on_task_switched_in(pxCurrentTCB, uxTopReadyPriority)
#endif
</RTE_Components_h>
</component>
</bundle>
</components>
<!-- optional taxonomy section for defining new component Class and Group names -->

View File

@ -53,6 +53,8 @@ PACK_BASE_FILES="
perf_counter.h
systick_wrapper_gcc.s
systick_wrapper_ual.s
perf_os_patch_rtx5.c
perf_os_patch_freertos.c
LICENSE
README.md
"
@ -137,6 +139,10 @@ fi
# pdsc file is mandatory in base directory:
cp -f ./$PACK_VENDOR.$PACK_NAME.pdsc ${PACK_BUILD}
cp -f ./perf_os_patch_rtx5.c ./lib
cp -f ./perf_os_patch_freertos.c ./lib
cp -f ./perf_counter.h ./lib
# directories
echo Adding directories to pack:
echo $PACK_DIRS
@ -155,6 +161,8 @@ do
cp -f "$f" $PACK_BUILD/
done
# Run Schema Check (for Linux only):
# sudo apt-get install libxml2-utils
@ -198,7 +206,8 @@ if [ $errorlevel -ne 0 ]; then
exit
fi
cp -f ./$PACK_VENDOR.$PACK_NAME.pdsc ${PACK_WAREHOUSE}
cp -f ./$PACK_VENDOR.$PACK_NAME.pdsc ${PACK_WAREHOUSE}
echo "build of pack succeeded"
# Clean up

View File

@ -31,42 +31,41 @@
//! @{
//! \note for IAR
#ifdef __IS_COMPILER_IAR__
# undef __IS_COMPILER_IAR__
#endif
#undef __IS_COMPILER_IAR__
#if defined(__IAR_SYSTEMS_ICC__)
# define __IS_COMPILER_IAR__ 1
#endif
//! \note for arm compiler 5
#ifdef __IS_COMPILER_ARM_COMPILER_5__
# undef __IS_COMPILER_ARM_COMPILER_5__
#endif
#undef __IS_COMPILER_ARM_COMPILER_5__
#if ((__ARMCC_VERSION >= 5000000) && (__ARMCC_VERSION < 6000000))
# define __IS_COMPILER_ARM_COMPILER_5__ 1
#endif
//! @}
//! \note for arm compiler 6
#ifdef __IS_COMPILER_ARM_COMPILER_6__
# undef __IS_COMPILER_ARM_COMPILER_6__
#endif
#undef __IS_COMPILER_ARM_COMPILER_6__
#if defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)
# define __IS_COMPILER_ARM_COMPILER_6__ 1
#endif
#ifdef __IS_COMPILER_LLVM__
# undef __IS_COMPILER_LLVM__
#undef __IS_COMPILER_ARM_COMPILER__
#if defined(__IS_COMPILER_ARM_COMPILER_5__) && __IS_COMPILER_ARM_COMPILER_5__ \
|| defined(__IS_COMPILER_ARM_COMPILER_6__) && __IS_COMPILER_ARM_COMPILER_6__
# define __IS_COMPILER_ARM_COMPILER__ 1
#endif
#undef __IS_COMPILER_LLVM__
#if defined(__clang__) && !__IS_COMPILER_ARM_COMPILER_6__
# define __IS_COMPILER_LLVM__ 1
#else
//! \note for gcc
# ifdef __IS_COMPILER_GCC__
# undef __IS_COMPILER_GCC__
# endif
# if defined(__GNUC__) && !( defined(__IS_COMPILER_ARM_COMPILER_5__) \
|| defined(__IS_COMPILER_ARM_COMPILER_6__) \
# undef __IS_COMPILER_GCC__
# if defined(__GNUC__) && !( defined(__IS_COMPILER_ARM_COMPILER__) \
|| defined(__IS_COMPILER_LLVM__))
# define __IS_COMPILER_GCC__ 1
# endif
@ -254,6 +253,13 @@
})
/*============================ TYPES =========================================*/
typedef struct {
uint64_t dwStart;
uint64_t dwUsedTotal;
uint32_t dwUsedRecent;
uint32_t wActiveCount;
} task_cycle_info_t;
/*============================ GLOBAL VARIABLES ==============================*/
/*============================ LOCAL VARIABLES ===============================*/
/*============================ PROTOTYPES ====================================*/
@ -313,6 +319,35 @@ __attribute__((nothrow))
extern int64_t get_system_ticks(void);
#if defined(__PERF_CNT_USE_RTOS__)
/*! \brief provide cycle information for target task if perf_counter is used
*! together with an RTOS in the support list.
*!
*! Support RTOS List:
*! - RTX5
*/
extern task_cycle_info_t * get_rtos_task_cycle_info(void);
/*! \brief start cycle counter for current task
*/
extern void start_task_cycle_counter(void);
/*! \brief calculate the elapsed cycle count for current task since the last
*! start point
*!
*! \note you can have multiple stop_cycle_counter following one start point
*!
*! \return the elapsed cycle count.
*/
extern int32_t stop_task_cycle_counter(void);
#elif !defined(__IMPLEMENT_PERF_COUNTER)
# define start_task_cycle_counter start_cycle_counter
# define stop_task_cycle_counter stop_cycle_counter
#endif
/*----------------------------------------------------------------------------*
* Please ignore the following APIs unless you have encountered some known *
* special conditions *

View File

@ -20,6 +20,8 @@
#include <stdbool.h>
#include <string.h>
#include "cmsis_compiler.h"
#define __IMPLEMENT_PERF_COUNTER
#include "perf_counter.h"
#if defined(__IS_COMPILER_GCC__)
@ -153,6 +155,11 @@ typedef struct
__IOM uint32_t CPACR; /*!< Offset: 0x088 (R/W) Coprocessor Access Control Register */
} SCB_Type;
struct __task_cycle_info_t {
uint64_t dwLastTimeStamp;
task_cycle_info_t tInfo;
} ;
/*============================ GLOBAL VARIABLES ==============================*/
extern uint32_t SystemCoreClock;
@ -379,3 +386,54 @@ int64_t get_system_ticks(void)
return lTemp;
}
__WEAK
task_cycle_info_t * get_rtos_task_cycle_info(void)
{
return NULL;
}
void __on_context_switch_in(uint32_t *pwStack)
{
struct __task_cycle_info_t *ptFrame = (struct __task_cycle_info_t *)pwStack;
uint64_t dwTimeStamp = get_system_ticks();
if (0 == ptFrame->tInfo.dwStart) {
ptFrame->tInfo.dwStart = dwTimeStamp;
}
ptFrame->dwLastTimeStamp = dwTimeStamp;
ptFrame->tInfo.wActiveCount++;
}
void __on_context_switch_out(uint32_t *pwStack)
{
uint64_t dwTimeStamp = get_system_ticks();
struct __task_cycle_info_t *ptFrame = (struct __task_cycle_info_t *)pwStack;
ptFrame->tInfo.dwUsedRecent = dwTimeStamp - ptFrame->dwLastTimeStamp;
ptFrame->tInfo.dwUsedTotal += ptFrame->tInfo.dwUsedRecent;
}
void start_task_cycle_counter(void)
{
task_cycle_info_t * ptInfo = get_rtos_task_cycle_info();
if (NULL != ptInfo) {
ptInfo->dwUsedTotal = 0;
}
}
int32_t stop_task_cycle_counter(void)
{
task_cycle_info_t * ptInfo = get_rtos_task_cycle_info();
if (NULL != ptInfo) {
return (int32_t)ptInfo->dwUsedTotal;
}
return 0;
}

View File

@ -31,42 +31,41 @@
//! @{
//! \note for IAR
#ifdef __IS_COMPILER_IAR__
# undef __IS_COMPILER_IAR__
#endif
#undef __IS_COMPILER_IAR__
#if defined(__IAR_SYSTEMS_ICC__)
# define __IS_COMPILER_IAR__ 1
#endif
//! \note for arm compiler 5
#ifdef __IS_COMPILER_ARM_COMPILER_5__
# undef __IS_COMPILER_ARM_COMPILER_5__
#endif
#undef __IS_COMPILER_ARM_COMPILER_5__
#if ((__ARMCC_VERSION >= 5000000) && (__ARMCC_VERSION < 6000000))
# define __IS_COMPILER_ARM_COMPILER_5__ 1
#endif
//! @}
//! \note for arm compiler 6
#ifdef __IS_COMPILER_ARM_COMPILER_6__
# undef __IS_COMPILER_ARM_COMPILER_6__
#endif
#undef __IS_COMPILER_ARM_COMPILER_6__
#if defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)
# define __IS_COMPILER_ARM_COMPILER_6__ 1
#endif
#ifdef __IS_COMPILER_LLVM__
# undef __IS_COMPILER_LLVM__
#undef __IS_COMPILER_ARM_COMPILER__
#if defined(__IS_COMPILER_ARM_COMPILER_5__) && __IS_COMPILER_ARM_COMPILER_5__ \
|| defined(__IS_COMPILER_ARM_COMPILER_6__) && __IS_COMPILER_ARM_COMPILER_6__
# define __IS_COMPILER_ARM_COMPILER__ 1
#endif
#undef __IS_COMPILER_LLVM__
#if defined(__clang__) && !__IS_COMPILER_ARM_COMPILER_6__
# define __IS_COMPILER_LLVM__ 1
#else
//! \note for gcc
# ifdef __IS_COMPILER_GCC__
# undef __IS_COMPILER_GCC__
# endif
# if defined(__GNUC__) && !( defined(__IS_COMPILER_ARM_COMPILER_5__) \
|| defined(__IS_COMPILER_ARM_COMPILER_6__) \
# undef __IS_COMPILER_GCC__
# if defined(__GNUC__) && !( defined(__IS_COMPILER_ARM_COMPILER__) \
|| defined(__IS_COMPILER_LLVM__))
# define __IS_COMPILER_GCC__ 1
# endif
@ -254,6 +253,13 @@
})
/*============================ TYPES =========================================*/
typedef struct {
uint64_t dwStart;
uint64_t dwUsedTotal;
uint32_t dwUsedRecent;
uint32_t wActiveCount;
} task_cycle_info_t;
/*============================ GLOBAL VARIABLES ==============================*/
/*============================ LOCAL VARIABLES ===============================*/
/*============================ PROTOTYPES ====================================*/
@ -313,6 +319,35 @@ __attribute__((nothrow))
extern int64_t get_system_ticks(void);
#if defined(__PERF_CNT_USE_RTOS__)
/*! \brief provide cycle information for target task if perf_counter is used
*! together with an RTOS in the support list.
*!
*! Support RTOS List:
*! - RTX5
*/
extern task_cycle_info_t * get_rtos_task_cycle_info(void);
/*! \brief start cycle counter for current task
*/
extern void start_task_cycle_counter(void);
/*! \brief calculate the elapsed cycle count for current task since the last
*! start point
*!
*! \note you can have multiple stop_cycle_counter following one start point
*!
*! \return the elapsed cycle count.
*/
extern int32_t stop_task_cycle_counter(void);
#elif !defined(__IMPLEMENT_PERF_COUNTER)
# define start_task_cycle_counter start_cycle_counter
# define stop_task_cycle_counter stop_cycle_counter
#endif
/*----------------------------------------------------------------------------*
* Please ignore the following APIs unless you have encountered some known *
* special conditions *

View File

@ -167,6 +167,11 @@
<AccSizeX>0</AccSizeX>
</Mm>
</MemoryWindow1>
<ScvdPack>
<Filename>C:\Keil_v5\ARM\PACK\Keil\ARM_Compiler\1.6.3\EventRecorder.scvd</Filename>
<Type>Keil.ARM_Compiler.1.6.3</Type>
<SubType>1</SubType>
</ScvdPack>
<ToolboxButtons>
<Wi>
<IntNumber>0</IntNumber>
@ -287,7 +292,7 @@
<sRfunc>1</sRfunc>
<sRbox>1</sRbox>
<tLdApp>1</tLdApp>
<tGomain>1</tGomain>
<tGomain>0</tGomain>
<tRbreak>1</tRbreak>
<tRwatch>1</tRwatch>
<tRmem>1</tRmem>
@ -365,6 +370,11 @@
<AccSizeX>0</AccSizeX>
</Mm>
</MemoryWindow1>
<ScvdPack>
<Filename>C:\Keil_v5\ARM\PACK\Keil\ARM_Compiler\1.6.3\EventRecorder.scvd</Filename>
<Type>Keil.ARM_Compiler.1.6.3</Type>
<SubType>1</SubType>
</ScvdPack>
<Tracepoint>
<THDelay>0</THDelay>
</Tracepoint>
@ -464,7 +474,7 @@
<OPTFL>
<tvExp>1</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<IsCurrentTarget>1</IsCurrentTarget>
<IsCurrentTarget>0</IsCurrentTarget>
</OPTFL>
<CpuCode>7</CpuCode>
<DebugOpt>
@ -478,7 +488,7 @@
<sRfunc>1</sRfunc>
<sRbox>1</sRbox>
<tLdApp>1</tLdApp>
<tGomain>1</tGomain>
<tGomain>0</tGomain>
<tRbreak>1</tRbreak>
<tRwatch>1</tRwatch>
<tRmem>1</tRmem>
@ -548,13 +558,6 @@
</SetRegEntry>
</TargetDriverDllRegistry>
<Breakpoint/>
<WatchWindow1>
<Ww>
<count>0</count>
<WinNumber>1</WinNumber>
<ItemText>rx_pin</ItemText>
</Ww>
</WatchWindow1>
<MemoryWindow1>
<Mm>
<WinNumber>1</WinNumber>
@ -563,6 +566,214 @@
<AccSizeX>0</AccSizeX>
</Mm>
</MemoryWindow1>
<ScvdPack>
<Filename>C:\Keil_v5\ARM\PACK\Keil\ARM_Compiler\1.6.3\EventRecorder.scvd</Filename>
<Type>Keil.ARM_Compiler.1.6.3</Type>
<SubType>1</SubType>
</ScvdPack>
<ToolboxButtons>
<Wi>
<IntNumber>0</IntNumber>
<FirstString>Reset Pico</FirstString>
<SecondString>debug_from_ram()</SecondString>
</Wi>
</ToolboxButtons>
<Tracepoint>
<THDelay>0</THDelay>
</Tracepoint>
<DebugFlag>
<trace>0</trace>
<periodic>1</periodic>
<aLwin>1</aLwin>
<aCover>0</aCover>
<aSer1>0</aSer1>
<aSer2>0</aSer2>
<aPa>0</aPa>
<viewmode>1</viewmode>
<vrSel>0</vrSel>
<aSym>0</aSym>
<aTbox>1</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>1</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>
<Target>
<TargetName>AC6-DebugInSRAM-printf</TargetName>
<ToolsetNumber>0x4</ToolsetNumber>
<ToolsetName>ARM-ADS</ToolsetName>
<TargetOption>
<CLKADS>12000000</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>1</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<IsCurrentTarget>1</IsCurrentTarget>
</OPTFL>
<CpuCode>7</CpuCode>
<DebugOpt>
<uSim>0</uSim>
<uTrg>1</uTrg>
<sLdApp>1</sLdApp>
<sGomain>0</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>3</nTsel>
<sDll></sDll>
<sDllPa></sDllPa>
<sDlgDll></sDlgDll>
<sDlgPa></sDlgPa>
<sIfile>.\debug.ini</sIfile>
<tDll></tDll>
<tDllPa></tDllPa>
<tDlgDll></tDlgDll>
<tDlgPa></tDlgPa>
<tIfile>.\debug_with_cmsis-dap_in_ram.ini</tIfile>
<pMon>BIN\CMSIS_AGDI.dll</pMon>
</DebugOpt>
<TargetDriverDllRegistry>
<SetRegEntry>
<Number>0</Number>
<Key>CMSIS_AGDI</Key>
<Name>-X"Any" -UAny -O718 -S0 -C0 -P00000000 -N00("ARM CoreSight SW-DP") -D00(0BC12477) -L00(0) -TO65554 -TC10000000 -TT10000000 -TP20 -TDS8007 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -FO7 -FD20000000 -FC1000 -FN0</Name>
</SetRegEntry>
<SetRegEntry>
<Number>0</Number>
<Key>JL2CM3</Key>
<Name>-U17935099 -O78 -S2 -ZTIFSpeedSel5000 -A0 -C0 -JU1 -JI127.0.0.1 -JP0 -RST0 -N00("ARM CoreSight SW-DP") -D00(0BC12477) -L00(0) -TO18 -TC10000000 -TP21 -TDS8007 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -TB1 -TFE0 -FO7 -FD20000000 -FC1000 -FN0</Name>
</SetRegEntry>
<SetRegEntry>
<Number>0</Number>
<Key>UL2CM3</Key>
<Name>UL2CM3(-S0 -C0 -P0 -FC1000 -FD20000000</Name>
</SetRegEntry>
<SetRegEntry>
<Number>0</Number>
<Key>DLGTARM</Key>
<Name>(1010=745,553,1156,1055,0)(1007=105,137,312,358,0)(1008=90,121,466,357,0)(1012=-1,-1,-1,-1,0)(1009=-1,-1,-1,-1,0)</Name>
</SetRegEntry>
<SetRegEntry>
<Number>0</Number>
<Key>DLGUARM</Key>
<Name></Name>
</SetRegEntry>
<SetRegEntry>
<Number>0</Number>
<Key>ARMRTXEVENTFLAGS</Key>
<Name>-L70 -Z18 -C0 -M0 -T1</Name>
</SetRegEntry>
<SetRegEntry>
<Number>0</Number>
<Key>DLGDARM</Key>
<Name>(1010=75,104,525,661,1)(1007=-1,-1,-1,-1,0)(1008=-1,-1,-1,-1,0)(1009=643,307,887,855,1)(1012=-1,-1,-1,-1,0)</Name>
</SetRegEntry>
<SetRegEntry>
<Number>0</Number>
<Key>ARMDBGFLAGS</Key>
<Name>-T0</Name>
</SetRegEntry>
</TargetDriverDllRegistry>
<Breakpoint/>
<MemoryWindow1>
<Mm>
<WinNumber>1</WinNumber>
<SubType>1</SubType>
<ItemText>0x2000AC00</ItemText>
<AccSizeX>0</AccSizeX>
</Mm>
</MemoryWindow1>
<ScvdPack>
<Filename>C:\Users\liang\AppData\Local\Arm\Packs\Keil\ARM_Compiler\1.6.3\EventRecorder.scvd</Filename>
<Type>Keil.ARM_Compiler.1.6.3</Type>
<SubType>1</SubType>
</ScvdPack>
<ToolboxButtons>
<Wi>
<IntNumber>0</IntNumber>
@ -593,7 +804,7 @@
<aLa>0</aLa>
<aPa1>0</aPa1>
<AscS4>0</AscS4>
<aSer4>0</aSer4>
<aSer4>1</aSer4>
<StkLoc>0</StkLoc>
<TrcWin>0</TrcWin>
<newCpu>0</newCpu>
@ -1024,18 +1235,6 @@
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>..\..\pico-sdk\src\rp2_common\pico_stdio\stdio.c</PathWithFileName>
<FilenameWithoutPath>stdio.c</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
<File>
<GroupNumber>1</GroupNumber>
<FileNumber>35</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>..\..\pico-sdk\src\rp2_common\pico_stdio_uart\stdio_uart.c</PathWithFileName>
<FilenameWithoutPath>stdio_uart.c</FilenameWithoutPath>
<RteFlg>0</RteFlg>
@ -1043,7 +1242,7 @@
</File>
<File>
<GroupNumber>1</GroupNumber>
<FileNumber>36</FileNumber>
<FileNumber>35</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
@ -1063,7 +1262,7 @@
<RteFlg>0</RteFlg>
<File>
<GroupNumber>2</GroupNumber>
<FileNumber>37</FileNumber>
<FileNumber>36</FileNumber>
<FileType>5</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
@ -1075,7 +1274,7 @@
</File>
<File>
<GroupNumber>2</GroupNumber>
<FileNumber>38</FileNumber>
<FileNumber>37</FileNumber>
<FileType>5</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
@ -1087,7 +1286,7 @@
</File>
<File>
<GroupNumber>2</GroupNumber>
<FileNumber>39</FileNumber>
<FileNumber>38</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
@ -1099,19 +1298,7 @@
</File>
<File>
<GroupNumber>2</GroupNumber>
<FileNumber>40</FileNumber>
<FileType>5</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>.\perf_counter\lib\perf_counter.h</PathWithFileName>
<FilenameWithoutPath>perf_counter.h</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
<File>
<GroupNumber>2</GroupNumber>
<FileNumber>41</FileNumber>
<FileNumber>39</FileNumber>
<FileType>5</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
@ -1121,6 +1308,18 @@
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
<File>
<GroupNumber>2</GroupNumber>
<FileNumber>40</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>.\wrapper\stdio.c</PathWithFileName>
<FilenameWithoutPath>stdio.c</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
</Group>
<Group>
@ -1131,7 +1330,7 @@
<RteFlg>0</RteFlg>
<File>
<GroupNumber>3</GroupNumber>
<FileNumber>42</FileNumber>
<FileNumber>41</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
@ -1149,6 +1348,18 @@
<tvExpOptDlg>0</tvExpOptDlg>
<cbSel>0</cbSel>
<RteFlg>0</RteFlg>
<File>
<GroupNumber>4</GroupNumber>
<FileNumber>42</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>..\..\..\..\src\BaseObj.c</PathWithFileName>
<FilenameWithoutPath>BaseObj.c</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
<File>
<GroupNumber>4</GroupNumber>
<FileNumber>43</FileNumber>
@ -1156,8 +1367,8 @@
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>..\..\pikascript\pikascript-core\BaseObj.c</PathWithFileName>
<FilenameWithoutPath>BaseObj.c</FilenameWithoutPath>
<PathWithFileName>..\..\..\..\src\dataArg.c</PathWithFileName>
<FilenameWithoutPath>dataArg.c</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
@ -1168,8 +1379,8 @@
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>..\..\pikascript\pikascript-core\dataArg.c</PathWithFileName>
<FilenameWithoutPath>dataArg.c</FilenameWithoutPath>
<PathWithFileName>..\..\..\..\src\dataArgs.c</PathWithFileName>
<FilenameWithoutPath>dataArgs.c</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
@ -1180,8 +1391,8 @@
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>..\..\pikascript\pikascript-core\dataArgs.c</PathWithFileName>
<FilenameWithoutPath>dataArgs.c</FilenameWithoutPath>
<PathWithFileName>..\..\..\..\src\dataLink.c</PathWithFileName>
<FilenameWithoutPath>dataLink.c</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
@ -1192,8 +1403,8 @@
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>..\..\pikascript\pikascript-core\dataLink.c</PathWithFileName>
<FilenameWithoutPath>dataLink.c</FilenameWithoutPath>
<PathWithFileName>..\..\..\..\src\dataLinkNode.c</PathWithFileName>
<FilenameWithoutPath>dataLinkNode.c</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
@ -1204,8 +1415,8 @@
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>..\..\pikascript\pikascript-core\dataLinkNode.c</PathWithFileName>
<FilenameWithoutPath>dataLinkNode.c</FilenameWithoutPath>
<PathWithFileName>..\..\..\..\src\dataMemory.c</PathWithFileName>
<FilenameWithoutPath>dataMemory.c</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
@ -1216,8 +1427,8 @@
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>..\..\pikascript\pikascript-core\dataMemory.c</PathWithFileName>
<FilenameWithoutPath>dataMemory.c</FilenameWithoutPath>
<PathWithFileName>..\..\..\..\src\dataQueue.c</PathWithFileName>
<FilenameWithoutPath>dataQueue.c</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
@ -1228,8 +1439,8 @@
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>..\..\pikascript\pikascript-core\dataQueue.c</PathWithFileName>
<FilenameWithoutPath>dataQueue.c</FilenameWithoutPath>
<PathWithFileName>..\..\..\..\src\dataQueueObj.c</PathWithFileName>
<FilenameWithoutPath>dataQueueObj.c</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
@ -1240,8 +1451,8 @@
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>..\..\pikascript\pikascript-core\dataQueueObj.c</PathWithFileName>
<FilenameWithoutPath>dataQueueObj.c</FilenameWithoutPath>
<PathWithFileName>..\..\..\..\src\dataStack.c</PathWithFileName>
<FilenameWithoutPath>dataStack.c</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
@ -1252,8 +1463,8 @@
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>..\..\pikascript\pikascript-core\dataStack.c</PathWithFileName>
<FilenameWithoutPath>dataStack.c</FilenameWithoutPath>
<PathWithFileName>..\..\..\..\src\dataString.c</PathWithFileName>
<FilenameWithoutPath>dataString.c</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
@ -1264,8 +1475,8 @@
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>..\..\pikascript\pikascript-core\dataString.c</PathWithFileName>
<FilenameWithoutPath>dataString.c</FilenameWithoutPath>
<PathWithFileName>..\..\..\..\src\dataStrs.c</PathWithFileName>
<FilenameWithoutPath>dataStrs.c</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
@ -1276,8 +1487,8 @@
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>..\..\pikascript\pikascript-core\dataStrs.c</PathWithFileName>
<FilenameWithoutPath>dataStrs.c</FilenameWithoutPath>
<PathWithFileName>..\..\..\..\src\PikaObj.c</PathWithFileName>
<FilenameWithoutPath>PikaObj.c</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
@ -1288,8 +1499,8 @@
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>..\..\pikascript\pikascript-core\PikaObj.c</PathWithFileName>
<FilenameWithoutPath>PikaObj.c</FilenameWithoutPath>
<PathWithFileName>..\..\..\..\src\PikaParser.c</PathWithFileName>
<FilenameWithoutPath>PikaParser.c</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
@ -1300,8 +1511,8 @@
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>..\..\pikascript\pikascript-core\PikaParser.c</PathWithFileName>
<FilenameWithoutPath>PikaParser.c</FilenameWithoutPath>
<PathWithFileName>..\..\..\..\src\PikaPlatform.c</PathWithFileName>
<FilenameWithoutPath>PikaPlatform.c</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
@ -1312,8 +1523,8 @@
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>..\..\pikascript\pikascript-core\PikaPlatform.c</PathWithFileName>
<FilenameWithoutPath>PikaPlatform.c</FilenameWithoutPath>
<PathWithFileName>..\..\..\..\src\PikaVM.c</PathWithFileName>
<FilenameWithoutPath>PikaVM.c</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
@ -1324,19 +1535,7 @@
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>..\..\pikascript\pikascript-core\PikaVM.c</PathWithFileName>
<FilenameWithoutPath>PikaVM.c</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
<File>
<GroupNumber>4</GroupNumber>
<FileNumber>58</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>..\..\pikascript\pikascript-core\TinyObj.c</PathWithFileName>
<PathWithFileName>..\..\..\..\src\TinyObj.c</PathWithFileName>
<FilenameWithoutPath>TinyObj.c</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
@ -1349,6 +1548,18 @@
<tvExpOptDlg>0</tvExpOptDlg>
<cbSel>0</cbSel>
<RteFlg>0</RteFlg>
<File>
<GroupNumber>5</GroupNumber>
<FileNumber>58</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>..\..\..\..\package\PikaStdLib\PikaStdLib_MemChecker.c</PathWithFileName>
<FilenameWithoutPath>PikaStdLib_MemChecker.c</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
<File>
<GroupNumber>5</GroupNumber>
<FileNumber>59</FileNumber>
@ -1356,8 +1567,8 @@
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>..\..\pikascript\pikascript-lib\PikaStdLib\PikaStdLib_List.c</PathWithFileName>
<FilenameWithoutPath>PikaStdLib_List.c</FilenameWithoutPath>
<PathWithFileName>..\..\..\..\package\PikaStdLib\PikaStdLib_RangeObj.c</PathWithFileName>
<FilenameWithoutPath>PikaStdLib_RangeObj.c</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
@ -1368,19 +1579,7 @@
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>..\..\pikascript\pikascript-lib\PikaStdLib\PikaStdLib_MemChecker.c</PathWithFileName>
<FilenameWithoutPath>PikaStdLib_MemChecker.c</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
<File>
<GroupNumber>5</GroupNumber>
<FileNumber>61</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>..\..\pikascript\pikascript-lib\PikaStdLib\PikaStdLib_SysObj.c</PathWithFileName>
<PathWithFileName>..\..\..\..\package\PikaStdLib\PikaStdLib_SysObj.c</PathWithFileName>
<FilenameWithoutPath>PikaStdLib_SysObj.c</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
@ -1395,7 +1594,7 @@
<RteFlg>0</RteFlg>
<File>
<GroupNumber>6</GroupNumber>
<FileNumber>62</FileNumber>
<FileNumber>61</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
@ -1407,7 +1606,7 @@
</File>
<File>
<GroupNumber>6</GroupNumber>
<FileNumber>63</FileNumber>
<FileNumber>62</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
@ -1419,19 +1618,7 @@
</File>
<File>
<GroupNumber>6</GroupNumber>
<FileNumber>64</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>..\..\pikascript\pikascript-api\PikaStdLib_List-api.c</PathWithFileName>
<FilenameWithoutPath>PikaStdLib_List-api.c</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
<File>
<GroupNumber>6</GroupNumber>
<FileNumber>65</FileNumber>
<FileNumber>63</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
@ -1443,7 +1630,19 @@
</File>
<File>
<GroupNumber>6</GroupNumber>
<FileNumber>66</FileNumber>
<FileNumber>64</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>..\..\pikascript\pikascript-api\PikaStdLib_RangeObj-api.c</PathWithFileName>
<FilenameWithoutPath>PikaStdLib_RangeObj-api.c</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
<File>
<GroupNumber>6</GroupNumber>
<FileNumber>65</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
@ -1455,7 +1654,7 @@
</File>
<File>
<GroupNumber>6</GroupNumber>
<FileNumber>67</FileNumber>
<FileNumber>66</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
@ -1467,6 +1666,26 @@
</File>
</Group>
<Group>
<GroupName>Python</GroupName>
<tvExp>1</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<cbSel>0</cbSel>
<RteFlg>0</RteFlg>
<File>
<GroupNumber>7</GroupNumber>
<FileNumber>67</FileNumber>
<FileType>5</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>..\..\pikascript\main.py</PathWithFileName>
<FilenameWithoutPath>main.py</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
</Group>
<Group>
<GroupName>::CMSIS</GroupName>
<tvExp>0</tvExp>
@ -1483,4 +1702,12 @@
<RteFlg>1</RteFlg>
</Group>
<Group>
<GroupName>::Utilities</GroupName>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<cbSel>0</cbSel>
<RteFlg>1</RteFlg>
</Group>
</ProjectOpt>

File diff suppressed because it is too large Load Diff

View File

@ -20,6 +20,12 @@
#include "RTE_Components.h"
#include <stdio.h>
#include "perf_counter.h"
#ifdef RTE_Compiler_EventRecorder
# include <EventRecorder.h>
#endif
/*============================ MACROS ========================================*/
/*============================ MACROFIED FUNCTIONS ===========================*/
/*============================ TYPES =========================================*/
@ -59,6 +65,21 @@ int stdin_getchar(void)
return byte;
}
#if defined(RTE_Compiler_EventRecorder) && defined(USE_EVR_FOR_STDOUR)
static int stdout_putchar (int ch) {
static uint32_t index = 0U;
static uint8_t buffer[8];
assert(index < sizeof(buffer));
buffer[index++] = (uint8_t)ch;
if ((index == sizeof(buffer)) || (ch == '\n')) {
EventRecordData(EventID(EventLevelOp, 0xFE, 0x00), buffer, index);
index = 0U;
}
return (ch);
}
#else
__attribute__((weak))
int stdout_putchar(int ch)
{
@ -71,6 +92,21 @@ int stdout_putchar(int ch)
return _write(1, (char *)&ch, 1);
}
#endif
int fputc (int c, FILE * stream)
{
#if (!defined(RTE_Compiler_IO_STDOUT) && !defined(RTE_Compiler_IO_STDERR))
(void)c;
(void)stream;
#endif
return stdout_putchar(c);
}
#else
/*! \note If you want to use semihosting (currently only Arm-DS supports it),
*! pleae open the RTE configuration and unselect the Compiler->I/O->STDIN
@ -128,3 +164,24 @@ void _sys_exit(int ret)
}
#endif
#if defined(RTE_Compiler_EventRecorder)
uint32_t EventRecorderTimerSetup(void)
{
return 1;
}
uint32_t EventRecorderTimerGetCount(void)
{
return get_system_ticks();
}
uint32_t EventRecorderTimerGetFreq (void)
{
extern uint32_t SystemCoreClock;
return SystemCoreClock;
}
#endif

View File

@ -17,9 +17,14 @@
/*============================ INCLUDES ======================================*/
#include "pico/stdlib.h"
#include "perf_counter.h"
#include "pico/stdio_usb.h"
#include <stdio.h>
#include "pikaScript.h"
#include <stdio.h>
#include "RTE_Components.h"
#if defined(RTE_Compiler_EventRecorder) && defined(USE_EVR_FOR_STDOUR)
# include <EventRecorder.h>
#endif
/*============================ MACROS ========================================*/
#define TOP (0x1FFF)
@ -76,40 +81,39 @@ static void breath_led(void)
static void system_init(void)
{
extern void SystemCoreClockUpdate();
SystemCoreClockUpdate();
/*! \note if you do want to use SysTick in your application, please use
*! init_cycle_counter(true);
*! instead of
*! init_cycle_counter(false);
*/
// init_cycle_counter(false);
stdio_init_all();
init_cycle_counter(false);
#if defined(RTE_Compiler_EventRecorder) && defined(USE_EVR_FOR_STDOUR)
EventRecorderInitialize(0, 1);
#endif
gpio_init(PICO_DEFAULT_LED_PIN);
gpio_set_dir(PICO_DEFAULT_LED_PIN, GPIO_OUT);
}
int main(void)
{
system_init();
printf("pico system init ok.\r\n");
printf("------------------------------------------------------------------\r\n");
printf("| |\r\n");
printf("| ____ _ __ _____ _ __ |\r\n");
printf("| / __ \\ (_) / /__ ____ _ / ___/ _____ _____ (_) ____ / /_ |\r\n");
printf("| / /_/ // / / //_// __ `/ \\__ \\ / ___// ___// / / __ \\ / __/ |\r\n");
printf("| / ____// / / ,< / /_/ / ___/ // /__ / / / / / /_/ // /_ |\r\n");
printf("| /_/ /_/ /_/|_| \\__,_/ /____/ \\___//_/ /_/ / .___/ \\__/ |\r\n");
printf("| /_/ |\r\n");
printf("| PikaScript - An Ultra Lightweight Python Engine |\r\n");
printf("| |\r\n");
printf("| [ https://github.com/pikastech/pikascript ] |\r\n");
printf("| [ https://gitee.com/lyon1998/pikascript ] |\r\n");
printf("| |\r\n");
printf("------------------------------------------------------------------\r\n");
PikaObj * pikaMain = pikaScriptInit();
printf("Hello Pico-Template\r\n");
uint32_t n = 0;
pikaScriptInit();
while (true) {
sleep_ms(500);
breath_led();
//gpio_put(PICO_DEFAULT_LED_PIN, 1);
//sleep_ms(500);
//gpio_put(PICO_DEFAULT_LED_PIN, 0);
//sleep_ms(500);
}
//return 0;
}

0
port/linux/api-make-linux.sh Executable file → Normal file
View File

0
port/linux/api-make-win10.sh Executable file → Normal file
View File

0
port/linux/api-make.sh Executable file → Normal file
View File

0
port/linux/ci_benchmark.sh Executable file → Normal file
View File

0
port/linux/ci_benchmark_calibration.py Executable file → Normal file
View File

0
port/linux/gtest.sh Executable file → Normal file
View File

0
port/linux/init.sh Executable file → Normal file
View File

0
port/linux/install_dependency.sh Executable file → Normal file
View File

0
port/linux/make.sh Executable file → Normal file
View File

0
port/linux/pkg-push.sh Executable file → Normal file
View File

0
port/linux/pull-core.sh Executable file → Normal file
View File

0
port/linux/push-core.sh Executable file → Normal file
View File

0
port/linux/test-banchmark.sh Executable file → Normal file
View File

0
port/linux/update-compiler.sh Executable file → Normal file
View File

0
tools/pikaCompiler/rust-msc-latest-linux Executable file → Normal file
View File