├── .gitattributes ├── .gitignore ├── .gitmodules ├── LICENSE ├── README.md ├── documents └── Pictures │ ├── Debug_printf_Viewer.png │ ├── EnableThePikaBeforeBuild.png │ ├── Enable_RP2040_LCD_1in28.png │ ├── Enable_RP2040_LCD_Touch_1in28.png │ ├── Reset_Pico.png │ ├── Select_Coremark_In_RTE.png │ ├── core_portme.png │ ├── coremark_result.png │ ├── enable_lcd_1in3 │ ├── pico-lcd-1.3-1.jpg │ └── rp2040-touch-lcd-1.28-1_1.jpg ├── main.c └── project └── mdk ├── DebugConfig ├── AC6-DebugInSRAM_RP2040_Core0_1.0.0.dbgconf ├── AC6-RunInSRAM_RP2040_Core0_1.0.0.dbgconf └── AC6-flash_RP2040_Core0_1.0.0.dbgconf ├── RP2040.sct ├── RP2040_debug_in_sram.sct ├── RP2040_run_in_sram.sct ├── RTE ├── Acceleration │ ├── DigitsFont.c │ ├── GLCD_Fonts.c │ ├── alarm_clock_font32.c │ ├── alarm_clock_font64.c │ ├── arm_2d_cfg.h │ ├── arm_2d_disp_adapter_0.c │ ├── arm_2d_disp_adapter_0.h │ ├── arm_2d_scene_gas_gauge.c │ ├── arm_2d_scene_gas_gauge.h │ └── ttf2c.py ├── CMSIS-View │ └── EventRecorderConf.h ├── Compiler │ └── EventRecorderConf.h ├── Device │ └── RP2040_Core0 │ │ ├── env_wrapper.h │ │ ├── rp2040.sct │ │ ├── rp2040_no_flash.sct │ │ ├── startup_rp2040.c │ │ └── system_rp2040.c └── Utilities │ └── core_portme.h ├── arm_2d_scene_bubble_charging.c ├── arm_2d_scene_bubble_charging.h ├── debug_with_cmsis-dap.ini ├── debug_with_cmsis-dap_in_ram.ini ├── template.uvoptx └── template.uvprojx /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Prerequisites 2 | *.d 3 | 4 | # Object files 5 | *.o 6 | *.ko 7 | *.obj 8 | *.elf 9 | 10 | # Linker output 11 | *.ilk 12 | *.map 13 | *.exp 14 | 15 | # Precompiled Headers 16 | *.gch 17 | *.pch 18 | 19 | # Libraries 20 | *.lib 21 | *.a 22 | *.la 23 | *.lo 24 | 25 | # Shared objects (inc. Windows DLLs) 26 | *.dll 27 | *.so 28 | *.so.* 29 | *.dylib 30 | 31 | # Executables 32 | *.out 33 | *.app 34 | *.i*86 35 | *.x86_64 36 | *.hex 37 | 38 | # Debug files 39 | *.dSYM/ 40 | *.su 41 | *.idb 42 | *.pdb 43 | 44 | # Kernel Module Compile Results 45 | *.mod* 46 | *.cmd 47 | .tmp_versions/ 48 | modules.order 49 | Module.symvers 50 | Mkfile.old 51 | dkms.conf 52 | *.dep 53 | project/mdk/template.uvguix.* 54 | project/mdk/Objects 55 | *.scvd 56 | *.iex 57 | project/mdk/JLinkLog.txt 58 | project/mdk/template.uf2 59 | *._ac 60 | *.__i 61 | *@* 62 | 63 | *.00?? 64 | 65 | project/mdk/RTE/PikaScript 66 | RTE_Components.h 67 | Pre_Include_* 68 | project/mdk/RTE/Acceleration/README.md 69 | project/mdk/RTE/Acceleration/img2c.py 70 | project/mdk/RTE/Acceleration/arm_2d.c 71 | project/mdk/RTE/Utilities/core_portme.c 72 | documents/Pictures/Thumbs.db 73 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "bsp"] 2 | path = bsp 3 | url = https://github.com/GorgonMeducer/RP2040_BSP.git 4 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Pico_Template (v2.3.2) 2 | An MDK template for Raspberry Pi Pico 3 | 4 | - Use RPi official [RP2xxxx_DFP](https://www.keil.arm.com/packs/rp2xxx_dfp-raspberrypi/boards/) 5 | 6 | - Add Flash Programming algorithm. 7 | 8 | - Special thanks to [Aladdin-Wang](https://github.com/Aladdin-Wang). [His extraordinary work](https://github.com/Aladdin-Wang/RP2040_Flash_Algorithm) makes our life much easier! 9 | - Special thanks to [fang316](https://github.com/fang316), whose suggestion improves how the flash programming algorithm is deployed. 10 | - Compiler: Arm Compiler 6.15 and above (Using non-intrusive wrapper to support pico-sdk which is written in GCC) 11 | - Improved BSP support 12 | 13 | - Add support for popular [LCD 1.3inc module](https://www.waveshare.com/wiki/Pico-LCD-1.3) : define macro `__PICO_USE_LCD_1IN3__` to enable it. 14 | 15 | - Add support for [RP2040 LCD 1.28inch development kit](https://www.waveshare.com/wiki/RP2040-LCD-1.28): define macro `__RP2040_USE_LCD_1IN28__` to enable it. 16 | 17 | - Add support for [PR2040 LCD Touch 1.28inch development kit](https://www.waveshare.com/wiki/RP2040-Touch-LCD-1.28): define macro `__RP2040_USE_LCD_TOUCH_1IN28__` to enable it. 18 | - Support an ultra-lightweight python VM: [PikaScript](https://github.com/pikasTech/pikascript) (via cmsis-pack) 19 | - Compatible with CMSIS 5.7.0, CMSIS 6.0.0 and above 20 | - **Ready for running [Arm-2D](https://github.com/ARM-software/Arm-2D) benchmarks** 21 | - **Ready for coremark** 22 | - **Support Debug in MDK** 23 | 24 | - [Using CMSIS-DAP](https://github.com/majbthrd/pico-debug) (Validated in MDK and **highly recommended**) 25 | - **Support Flash Downloading** 26 | - Add dedicated project configurations for: 27 | - [**AC6-flash**] Running code in Flash (XIP) 28 | 29 | - [**AC6-DebugInSRAM**] "no_flash" mode in the original pico-sdk. 30 | 31 | 32 | # How to Use 33 | 34 | ## 1. Get the Pico_Template 35 | 36 | I assume that you have the MDK installed on your PC. Please clone the Pico_Template with following command line: 37 | 38 | ``` 39 | mkdir pico-mdk 40 | cd pico-mdk 41 | 42 | git clone https://github.com/GorgonMeducer/Pico_Template . 43 | 44 | git submodule update --init 45 | ``` 46 | 47 | Instead of using git clone, if you download a release package, then you have to download the [pico-sdk](https://github.com/raspberrypi/pico-sdk) manually and put them into the corresponding folder: 48 | 49 | | submodules | URL | Directory | 50 | | ---------- | ------------------------------------------- | --------- | 51 | | bsp | https://github.com/GorgonMeducer/RP2040_BSP | ROOT\bsp | 52 | 53 | The project template also depends on [perf_counter](https://github.com/GorgonMeducer/perf_counter) which is deployed with a **cmsis-pack** that you can find in the **MDK pack installer**. 54 | 55 | 56 | 57 | ## 2. Use the Template 58 | 59 | The MDK project could be found in the path "ROOT\project\mdk". I assume you know how to use MDK for normal compilation. 60 | 61 | ### 2.1 How to set the Stack and Heap size 62 | 63 | Usually, people want to adjust the size of stack and heap, and it is very easy in this template. Please find the file "RP2040.sct" in the same MDK project directory. Find the macro ***STACK_0_SIZE*** for stack and ***HEAP_0_SIZE*** for the heap. 64 | 65 | 66 | 67 | ``` 68 | #define STACK_0_SIZE (1024*4) 69 | #define STACK_1_SIZE (1024*1) 70 | 71 | #define HEAP_0_SIZE (1024*32) 72 | #define HEAP_1_SIZE (1024*1) 73 | ``` 74 | 75 | ***NOTE***: 76 | 77 | 1. Please do **NOT** add "**u**" behind those constant values. 78 | 2. The STACK_1_SIZE and HEAP_1_SIZE are not in use. You can set their value to reasonable smaller ones if you do want to reduce the RAM footprint. 79 | 80 | 81 | 82 | ### 2.2 How to retarget stdout/stdin 83 | 84 | To take advantage of pico-sdk, this template uses bridges to retarget low level functions of stdout/stdin to _read and _write implemented by stdio.c inside pico-sdk. 85 | 86 | ``` 87 | /*----------------------------------------------------------------------------* 88 | * bridge the Arm Compiler's stdio and the pico-sdk's stdio * 89 | *----------------------------------------------------------------------------*/ 90 | __attribute__((weak)) 91 | int stdin_getchar(void) 92 | { 93 | /*! \note If you don't want to use pico-sdk stdio, then you can implement 94 | *! function by yourself in other c source code. Your scanf will work 95 | *! directly. 96 | *! by default, we use this function to bridge the _read implemented 97 | *! in stdio.c of pico-sdk 98 | */ 99 | 100 | int byte; 101 | _read(0, (char *)&byte, 1); 102 | return byte; 103 | } 104 | 105 | __attribute__((weak)) 106 | int stdout_putchar(int ch) 107 | { 108 | /*! \note If you don't want to use pico-sdk stdio, then you can implement 109 | *! function by yourself in other c source code. Your printf will work 110 | *! directly. 111 | *! by default, we use this function to bridge the _write implemented 112 | *! in stdio.c of pico-sdk 113 | */ 114 | 115 | return _write(1, (char *)&ch, 1); 116 | } 117 | 118 | ``` 119 | 120 | Those bridge functions are decorated as "weak", hence if you want to retarget ***printf/scanf*** directly to a place where you can "***see through***" and/or ***you have total control***, please implement those bridge functions (without delete the weak version) in one of your c source code, for example, sending chars to USART or storing them to a memory block directly. 121 | 122 | **NOTE**: I try to provide you the freedom of choice, and I don't need you to digging deep inside scripts to gain such freedom. 123 | 124 | 125 | 126 | When using configuration**AC6-DebugInSRAM-printf**, all ***printf*** output is retargeted to '**Debug (printf) Viewer**' inside MDK (as shown below) with the help from EventRecorder. 127 | 128 | ![image-20220104201854052](documents/Pictures/Debug_printf_Viewer.png) 129 | 130 | 131 | 132 | ### 2.3 How to debug using pico-debug (CMSIS-DAP) 133 | 134 | [Pico-debug](https://github.com/majbthrd/pico-debug) is an open-source project which turns one Cortex-M0+ core in RP2040 into a CMSIS-DAP adapter. It means that without an extra one, you can debug a Pico in MDK with just one USB connector. In order to do so, please [download the latest uf2 file](https://github.com/majbthrd/pico-debug/releases) first. 135 | 136 | 137 | 138 | Pico-Template provides a dedicated project configuration for downloading and debugging code in SRAM. This is the most convenient one and it delivers the best development experience among the three configurations. To use it, please follow the steps below: 139 | 140 | 1. Boot the Pico with the **BOOTSEL** button pressed. 141 | 2. Drag and drop **pico-debug-gimmecache.uf2** to RPI-RP2 mass-storage driver in the explorer. It immediately reboots as a **CMSIS-DAP adapter**. Pico-debug loads as a RAM only `.uf2` image, meaning that it is never written to flash and doesn't replace existing user code. 142 | 3. Compile and Debug 143 | 5. Enjoy... 144 | 145 | **NOTE: ** 146 | 147 | **1. In this mode, the "RESET" doesn't really work as we expect. If you do want to RESET, please press the "Reset Pico " button shown below:** 148 | 149 | ![image-20210919180644156](documents/Pictures/Reset_Pico.png) 150 | 151 | **2. If you cannot find this Toolbox, please start your debug session and go to menu "View"->"Toolbox Window".** 152 | 153 | 154 | 155 | ### 2.4 How to enable support for the LCD 1.3inc Module 156 | 157 | To make it easier for people to turn Pico into a 'game pad', I've picked a popular [1.3inc LCD module](https://www.waveshare.com/wiki/Pico-LCD-1.3) and added a tailored driver into this Pico template. 158 | 159 | In brief, it is an 160 | 161 | > 1.3inch LCD Display Module For Raspberry Pi Pico, 65K RGB Colors, 240×240 Pixels, SPI Interface 162 | 163 | 164 | 165 | 166 | To enable the built in support, please set the macro `__PICO_USE_LCD_1IN3__` to `1` in MDK project configuration as shown below: 167 | 168 | ![](./documents/Pictures/enable_lcd_1in3) 169 | 170 | After that, you can 171 | 172 | - Use the API `GLCD_DrawBitmap()` to flush a display buffer to the 1.3 inch LCD fully or partially (with specified location and size). 173 | 174 | ```c 175 | extern 176 | void GLCD_DrawBitmap( int_fast16_t x, int_fast16_t y, 177 | int_fast16_t width, int_fast16_t height, 178 | uint16_t *frame_ptr); 179 | ``` 180 | 181 | **NOTE**: an alternative API, i.e. `Disp0_DrawBitmap`, is ready for working with Arm-2D. 182 | 183 | - 184 | 185 | ### 2.5 How to enable support for the RP2040 LCD 1.28inch development kit 186 | 187 | To make it easier for people to create watch faces, I've picked a popular [LCD 1.28inch development kit](https://www.waveshare.com/wiki/RP2040-LCD-1.28) and added a tailored driver into this Pico template. 188 | 189 | In brief, it is an 190 | 191 | > RP2040 MCU Board, With 1.28inch Round LCD, accelerometer and gyroscope Sensor 192 | rp2040-lcd-1 28-1_1 193 | 194 | 195 | 196 | To enable the built in support, please set the macro `__RP2040_USE_LCD_1IN28__` to `1` in MDK project configuration as shown below: 197 | 198 | ![EnbaleRP2040LCD1in28](./documents/Pictures/Enable_RP2040_LCD_1in28.png) 199 | 200 | ### 2.6 How to enable support for the RP2040 LCD Touch 1.28inch development kit 201 | 202 | To make it easier for people to create watch faces, I've picked a popular [PR2040 LCD Touch 1.28inch development kit](https://www.waveshare.com/wiki/RP2040-Touch-LCD-1.28) and added a tailored driver into this Pico template. 203 | 204 | In brief, it is an 205 | 206 | > RP2040 MCU Board, With 1.28inch Round Touch LCD, accelerometer and gyroscope Sensor 207 | > 208 | 209 | 210 | 211 | To enable the built in support, please set the macro `__RP2040_USE_LCD_TOUCH_1IN28__` to `1` in MDK project configuration as shown below: 212 | 213 | ![EnbaleRP2040LCDTouch1in28](./documents/Pictures/Enable_RP2040_LCD_Touch_1in28.png) 214 | 215 | 216 | 217 | ### 2.7 How to enable the PikaScript Support 218 | 219 | > PikaScript is an ultra-lightweight Python engine with zero dependencies and zero-configuration, that can run with 4KB of RAM and 32KB of flash (such as STM32G030C8 and STM32F103C8). 220 | 221 | Pico-Template supports [PikaScript](https://github.com/pikasTech/pikascript) via cmsis-pack which you can find in the root directory. After the installation, please following the [official guidance](https://pikadoc.readthedocs.io/en/latest/get-start_cmsis-pack.html) to enable the support. 222 | 223 | **NOTE**: The first time compilation after ***selecting the Before Build/Rebuild*** might takes a longer time than you thought. 224 | 225 | ![](./documents/Pictures/EnableThePikaBeforeBuild.png) 226 | 227 | ### 2.8 How to run Coremark 228 | 229 | With the help from `perf_counter v2.0.0` , we can now run **[coremark](https://github.com/eembc/coremark)** on Pico-Template with just one click in RTE as shown below: 230 | 231 | ![](./documents/Pictures/Select_Coremark_In_RTE.png) 232 | 233 | A code in `main()` will run the coremark after that: 234 | 235 | ```c 236 | int main(void) 237 | { 238 | system_init(); 239 | 240 | printf("Hello Pico-Template\r\n"); 241 | 242 | ... 243 | 244 | #if defined( __PERF_COUNTER_COREMARK__ ) && __PERF_COUNTER_COREMARK__ 245 | printf("\r\nRun Coremark 1.0...\r\n"); 246 | coremark_main(); 247 | #endif 248 | ... 249 | 250 | while (true) { 251 | breath_led(); 252 | ... 253 | } 254 | } 255 | ``` 256 | 257 | By default, you can observe the test result in **Debug (printf) View** as shown below: 258 | 259 | ![](./documents/Pictures/coremark_result.png) 260 | 261 | 262 | 263 | **NOTE**: **The coremark has to run at least 10 secs to generate a valid result**. Fail to do so, you can change the macro `ITERATIONS` defined in `core_portme.h` to a bigger value and try again. 264 | 265 | ![](./documents/Pictures/core_portme.png) 266 | 267 | 268 | 269 | -------------------------------------------------------------------------------- /documents/Pictures/Debug_printf_Viewer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GorgonMeducer/Pico_Template/06aecd38be544ae37d244058c3596263b2d50dc0/documents/Pictures/Debug_printf_Viewer.png -------------------------------------------------------------------------------- /documents/Pictures/EnableThePikaBeforeBuild.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GorgonMeducer/Pico_Template/06aecd38be544ae37d244058c3596263b2d50dc0/documents/Pictures/EnableThePikaBeforeBuild.png -------------------------------------------------------------------------------- /documents/Pictures/Enable_RP2040_LCD_1in28.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GorgonMeducer/Pico_Template/06aecd38be544ae37d244058c3596263b2d50dc0/documents/Pictures/Enable_RP2040_LCD_1in28.png -------------------------------------------------------------------------------- /documents/Pictures/Enable_RP2040_LCD_Touch_1in28.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GorgonMeducer/Pico_Template/06aecd38be544ae37d244058c3596263b2d50dc0/documents/Pictures/Enable_RP2040_LCD_Touch_1in28.png -------------------------------------------------------------------------------- /documents/Pictures/Reset_Pico.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GorgonMeducer/Pico_Template/06aecd38be544ae37d244058c3596263b2d50dc0/documents/Pictures/Reset_Pico.png -------------------------------------------------------------------------------- /documents/Pictures/Select_Coremark_In_RTE.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GorgonMeducer/Pico_Template/06aecd38be544ae37d244058c3596263b2d50dc0/documents/Pictures/Select_Coremark_In_RTE.png -------------------------------------------------------------------------------- /documents/Pictures/core_portme.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GorgonMeducer/Pico_Template/06aecd38be544ae37d244058c3596263b2d50dc0/documents/Pictures/core_portme.png -------------------------------------------------------------------------------- /documents/Pictures/coremark_result.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GorgonMeducer/Pico_Template/06aecd38be544ae37d244058c3596263b2d50dc0/documents/Pictures/coremark_result.png -------------------------------------------------------------------------------- /documents/Pictures/enable_lcd_1in3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GorgonMeducer/Pico_Template/06aecd38be544ae37d244058c3596263b2d50dc0/documents/Pictures/enable_lcd_1in3 -------------------------------------------------------------------------------- /documents/Pictures/pico-lcd-1.3-1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GorgonMeducer/Pico_Template/06aecd38be544ae37d244058c3596263b2d50dc0/documents/Pictures/pico-lcd-1.3-1.jpg -------------------------------------------------------------------------------- /documents/Pictures/rp2040-touch-lcd-1.28-1_1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GorgonMeducer/Pico_Template/06aecd38be544ae37d244058c3596263b2d50dc0/documents/Pictures/rp2040-touch-lcd-1.28-1_1.jpg -------------------------------------------------------------------------------- /main.c: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | * Copyright 2021 Gorgon Meducer (Email:embedded_zhuoran@hotmail.com) * 3 | * * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); * 5 | * you may not use this file except in compliance with the License. * 6 | * You may obtain a copy of the License at * 7 | * * 8 | * http://www.apache.org/licenses/LICENSE-2.0 * 9 | * * 10 | * Unless required by applicable law or agreed to in writing, software * 11 | * distributed under the License is distributed on an "AS IS" BASIS, * 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * 13 | * See the License for the specific language governing permissions and * 14 | * limitations under the License. * 15 | * * 16 | ****************************************************************************/ 17 | /*============================ INCLUDES ======================================*/ 18 | #include "pico/stdlib.h" 19 | #include "perf_counter.h" 20 | #include "bsp/bsp.h" 21 | 22 | #include 23 | 24 | #include "RTE_Components.h" 25 | #if defined(RTE_Compiler_EventRecorder) || defined(RTE_CMSIS_View_EventRecorder) 26 | # include 27 | #endif 28 | 29 | #if defined(RTE_Script_PikaScript) 30 | # include "pikaScript.h" 31 | #endif 32 | 33 | #if defined(__RTE_ACCELERATION_ARM_2D__) || defined(RTE_Acceleration_Arm_2D) 34 | # include "arm_2d.h" 35 | # include "arm_2d_helper.h" 36 | # include "arm_2d_disp_adapters.h" 37 | # include "arm_2d_scenes.h" 38 | # include "arm_2d_demos.h" 39 | 40 | #endif 41 | 42 | #if defined(RTE_Acceleration_Arm_2D_Extra_Benchmark) 43 | # include "arm_2d_benchmark.h" 44 | #endif 45 | 46 | # include "arm_2d_scene_bubble_charging.h" 47 | 48 | 49 | /*============================ MACROS ========================================*/ 50 | /*============================ MACROFIED FUNCTIONS ===========================*/ 51 | /*============================ TYPES =========================================*/ 52 | /*============================ GLOBAL VARIABLES ==============================*/ 53 | /*============================ LOCAL VARIABLES ===============================*/ 54 | /*============================ PROTOTYPES ====================================*/ 55 | /*============================ IMPLEMENTATION ================================*/ 56 | 57 | void SysTick_Handler(void) 58 | { 59 | 60 | } 61 | 62 | static void system_init(void) 63 | { 64 | extern void SystemCoreClockUpdate(); 65 | 66 | SystemCoreClockUpdate(); 67 | /*! \note if you do want to use SysTick in your application, please use 68 | *! init_cycle_counter(true); 69 | *! instead of 70 | *! init_cycle_counter(false); 71 | */ 72 | init_cycle_counter(false); 73 | 74 | #if defined(RTE_Compiler_EventRecorder) || defined(RTE_CMSIS_View_EventRecorder) 75 | EventRecorderInitialize(0, 1); 76 | #endif 77 | stdio_init_all(); 78 | 79 | bsp_init(); 80 | 81 | #if defined(RTE_Script_PikaScript) 82 | pikaScriptInit(); 83 | #endif 84 | 85 | #if defined(__RTE_ACCELERATION_ARM_2D__) || defined(RTE_Acceleration_Arm_2D) 86 | arm_2d_init(); 87 | disp_adapter0_init(); 88 | #endif 89 | } 90 | 91 | 92 | int main(void) 93 | { 94 | system_init(); 95 | 96 | __cycleof__("printf") { 97 | printf("Hello Pico-Template\r\n"); 98 | } 99 | 100 | 101 | #if defined( __PERF_COUNTER_COREMARK__ ) && __PERF_COUNTER_COREMARK__ 102 | printf("\r\nRun Coremark 1.0...\r\n"); 103 | coremark_main(); 104 | #endif 105 | 106 | 107 | #if defined(__RTE_ACCELERATION_ARM_2D__) || defined(RTE_Acceleration_Arm_2D) 108 | 109 | # if defined(RTE_Acceleration_Arm_2D_Extra_Benchmark) 110 | arm_2d_run_benchmark(); 111 | #else 112 | //arm_2d_scene_bubble_charging_init(&DISP0_ADAPTER); 113 | //arm_2d_scene_player_switch_to_next_scene(&DISP0_ADAPTER); 114 | # endif 115 | 116 | #endif 117 | 118 | while (true) { 119 | breath_led(); 120 | 121 | #if defined(__RTE_ACCELERATION_ARM_2D__) || defined(RTE_Acceleration_Arm_2D) 122 | #if ARM_2D_VERSION >= 10105 && !defined(RTE_Acceleration_Arm_2D_Extra_Benchmark) 123 | /* lock framerate: 30 FPS */ 124 | disp_adapter0_task(30); 125 | #else 126 | disp_adapter0_task(); 127 | #endif 128 | #endif 129 | } 130 | //return 0; 131 | } 132 | -------------------------------------------------------------------------------- /project/mdk/DebugConfig/AC6-DebugInSRAM_RP2040_Core0_1.0.0.dbgconf: -------------------------------------------------------------------------------- 1 | // File: rp2040.dbgconf 2 | // Version: 1.0.0 3 | // Note: refer to rp2040 data sheet 4 | 5 | // <<< Use Configuration Wizard in Context Menu >>> 6 | 7 | // <<< end of configuration section >>> 8 | -------------------------------------------------------------------------------- /project/mdk/DebugConfig/AC6-RunInSRAM_RP2040_Core0_1.0.0.dbgconf: -------------------------------------------------------------------------------- 1 | // File: rp2040.dbgconf 2 | // Version: 1.0.0 3 | // Note: refer to rp2040 data sheet 4 | 5 | // <<< Use Configuration Wizard in Context Menu >>> 6 | 7 | // <<< end of configuration section >>> 8 | -------------------------------------------------------------------------------- /project/mdk/DebugConfig/AC6-flash_RP2040_Core0_1.0.0.dbgconf: -------------------------------------------------------------------------------- 1 | // File: rp2040.dbgconf 2 | // Version: 1.0.0 3 | // Note: refer to rp2040 data sheet 4 | 5 | // <<< Use Configuration Wizard in Context Menu >>> 6 | 7 | // <<< end of configuration section >>> 8 | -------------------------------------------------------------------------------- /project/mdk/RP2040.sct: -------------------------------------------------------------------------------- 1 | #! armclang -E --target=arm-arm-none-eabi -mcpu=cortex-m0 -xc 2 | ; command above MUST be in first line (no comment above!) 3 | ; ************************************************************* 4 | ; *** Scatter-Loading Description File generated by uVision *** 5 | ; ************************************************************* 6 | 7 | #define FLASH_SIZE 0x00200000 8 | #define SRAM_SIZE (1024*248) 9 | 10 | #define STACK_0_SIZE (1024*4) 11 | #define STACK_1_SIZE (1024*1) 12 | 13 | #define HEAP_0_SIZE (1024*32) 14 | #define HEAP_1_SIZE (1024*1) 15 | 16 | #define RAMSIZE_VALID (SRAM_SIZE - \ 17 | STACK_1_SIZE - HEAP_1_SIZE - \ 18 | STACK_0_SIZE - HEAP_0_SIZE - 0x100) 19 | 20 | LR_STAGE2_BOOT 0x10000000 0x100 { 21 | ER_STAGE2_BOOT +0 0x100 { 22 | compile_time_choice.o (+RO) 23 | } 24 | ER_FILL ImageLimit(ER_STAGE2_BOOT) FILL 0xDEADBEEF 0x100 - ImageLength(ER_STAGE2_BOOT) { 25 | } 26 | } 27 | 28 | LR_IROM1 0x10000100 FLASH_SIZE - ImageLength(LR_STAGE2_BOOT) { ; load region size_region 29 | 30 | ER_FLASH +0 0x00200000 { ; load address = execution address 31 | * (RESET, +First) 32 | *(InRoot$$Sections) 33 | 34 | * (.flashdata.*) 35 | * (:gdef:Reset_Handler) 36 | * (:gdef:SystemInit) 37 | .ANY (+RO) 38 | .ANY (+XO) 39 | } 40 | 41 | ER_RAM_VECTOR_TABLE 0x20000000 { 42 | .ANY (.ram_vector_table) 43 | } 44 | 45 | ARM_LIB_STACK +0 ALIGN 8 EMPTY STACK_0_SIZE { 46 | } 47 | 48 | ARM_LIB_STACK_ONE +0 ALIGN 8 EMPTY STACK_1_SIZE { 49 | } 50 | ARM_LIB_HEAP +0 ALIGN 8 EMPTY HEAP_0_SIZE { 51 | } 52 | ARM_LIB_HEAP_ONE +0 ALIGN 8 EMPTY HEAP_1_SIZE { 53 | } 54 | 55 | ER_MUTEX_ARRAY +0 { 56 | .ANY (.mutex_array.*) 57 | .ANY (.mutex_array) 58 | } 59 | 60 | ;ER_PREINIT_ARRAY +0 { 61 | ; * (.preinit_array.*) 62 | ; * (.preinit_array) 63 | ;} 64 | 65 | RW_IRAM +0 { ; RW data 66 | .ANY (.time_critical.*) 67 | .ANY (+RW +ZI) 68 | } 69 | 70 | RW_IRAM_NOINIT +0 UNINIT { ; RW data 71 | .ANY (.after_data.*) 72 | .ANY (.unintialized_data.*) 73 | .ANY (.bss.noinit) 74 | } 75 | 76 | } 77 | 78 | -------------------------------------------------------------------------------- /project/mdk/RP2040_debug_in_sram.sct: -------------------------------------------------------------------------------- 1 | #! armclang -E --target=arm-arm-none-eabi -mcpu=cortex-m0 -xc 2 | ; command above MUST be in first line (no comment above!) 3 | ; ************************************************************* 4 | ; *** Scatter-Loading Description File generated by uVision *** 5 | ; ************************************************************* 6 | 7 | #define FLASH_SIZE 0x00200000 8 | #define SRAM_SIZE (1024*248) 9 | 10 | #define STACK_0_SIZE (1024*4) 11 | #define STACK_1_SIZE (1024*1) 12 | 13 | #define HEAP_0_SIZE (1024*32) 14 | #define HEAP_1_SIZE (1024*1) 15 | 16 | #define RAMSIZE_VALID (SRAM_SIZE - \ 17 | STACK_1_SIZE - HEAP_1_SIZE - \ 18 | STACK_0_SIZE - HEAP_0_SIZE - 0x100) 19 | 20 | ;LR_STAGE2_BOOT 0x10000000 0x100 { 21 | ; ER_STAGE2_BOOT +0 0x100 { 22 | ; compile_time_choice.o (+RO) 23 | ; } 24 | ; ER_FILL ImageLimit(ER_STAGE2_BOOT) FILL 0xDEADBEEF 0x100 - ImageLength(ER_STAGE2_BOOT) { 25 | ; } 26 | ;} 27 | 28 | LR_IROM1 0x20000000 SRAM_SIZE { ; load region size_region 29 | 30 | ER_BINRAY_INFO +0 { 31 | * (:gdef:Reset_Handler) //!< please always make sure that Reset_Handler is placed here. 32 | * (.binary_info_header) 33 | } 34 | 35 | ER_RAM_VECTOR_TABLE +0 ALIGN 256 { 36 | * (.ram_vector_table) 37 | } 38 | 39 | 40 | ER_FLASH +0 { ; load address = execution address 41 | *.o (RESET, +First) 42 | *(InRoot$$Sections) 43 | * (+RO-DATA) 44 | startup_RP2040.o (+RO) 45 | } 46 | 47 | 48 | 49 | ER_MUTEX_ARRAY +0 { 50 | * (.mutex_array.*) 51 | * (.mutex_array) 52 | } 53 | 54 | RW_IRAM_CODE +0 { 55 | * (+RO-CODE) 56 | * (+XO) 57 | } 58 | 59 | ARM_LIB_STACK +0 ALIGN 8 EMPTY STACK_0_SIZE { 60 | } 61 | 62 | ARM_LIB_STACK_ONE +0 ALIGN 8 EMPTY STACK_1_SIZE { 63 | } 64 | ARM_LIB_HEAP +0 ALIGN 8 EMPTY HEAP_0_SIZE { 65 | } 66 | ARM_LIB_HEAP_ONE +0 ALIGN 8 EMPTY HEAP_1_SIZE { 67 | } 68 | 69 | 70 | 71 | ;ER_PREINIT_ARRAY +0 { 72 | ; * (.preinit_array.*) 73 | ; * (.preinit_array) 74 | ;} 75 | 76 | RW_IRAM +0 { ; RW data 77 | .ANY (+RW +ZI) 78 | } 79 | 80 | RW_IRAM_UNINIT +0 UNINIT { 81 | .ANY (.bss.noinit) 82 | } 83 | 84 | 85 | 86 | } 87 | 88 | -------------------------------------------------------------------------------- /project/mdk/RP2040_run_in_sram.sct: -------------------------------------------------------------------------------- 1 | #! armclang -E --target=arm-arm-none-eabi -mcpu=cortex-m0 -xc 2 | ; command above MUST be in first line (no comment above!) 3 | ; ************************************************************* 4 | ; *** Scatter-Loading Description File generated by uVision *** 5 | ; ************************************************************* 6 | 7 | #define FLASH_SIZE 0x00200000 8 | #define SRAM_SIZE (1024*248) 9 | 10 | #define STACK_0_SIZE (1024*4) 11 | #define STACK_1_SIZE (1024*1) 12 | 13 | #define HEAP_0_SIZE (1024*32) 14 | #define HEAP_1_SIZE (1024*1) 15 | 16 | #define RAMSIZE_VALID (SRAM_SIZE - \ 17 | STACK_1_SIZE - HEAP_1_SIZE - \ 18 | STACK_0_SIZE - HEAP_0_SIZE - 0x100) 19 | 20 | LR_STAGE2_BOOT 0x10000000 0x100 { 21 | ER_STAGE2_BOOT +0 0x100 { 22 | compile_time_choice.o (+RO) 23 | } 24 | ER_FILL ImageLimit(ER_STAGE2_BOOT) FILL 0xDEADBEEF 0x100 - ImageLength(ER_STAGE2_BOOT) { 25 | } 26 | } 27 | 28 | LR_IROM1 0x10000100 FLASH_SIZE - ImageLength(LR_STAGE2_BOOT) { ; load region size_region 29 | 30 | ER_FLASH +0 0x00200000 { ; load address = execution address 31 | *.o (RESET, +First) 32 | *(InRoot$$Sections) 33 | * (+RO-DATA) 34 | startup_RP2040.o (+RO) 35 | } 36 | 37 | ER_RAM_VECTOR_TABLE 0x20000000 { 38 | * (.ram_vector_table) 39 | } 40 | 41 | ARM_LIB_STACK +0 ALIGN 8 EMPTY STACK_0_SIZE { 42 | } 43 | 44 | ARM_LIB_STACK_ONE +0 ALIGN 8 EMPTY STACK_1_SIZE { 45 | } 46 | ARM_LIB_HEAP +0 ALIGN 8 EMPTY HEAP_0_SIZE { 47 | } 48 | ARM_LIB_HEAP_ONE +0 ALIGN 8 EMPTY HEAP_1_SIZE { 49 | } 50 | 51 | ER_MUTEX_ARRAY +0 { 52 | * (.mutex_array.*) 53 | * (.mutex_array) 54 | } 55 | 56 | ;ER_PREINIT_ARRAY +0 { 57 | ; * (.preinit_array.*) 58 | ; * (.preinit_array) 59 | ;} 60 | 61 | RW_IRAM +0 RAMSIZE_VALID { ; RW data 62 | .ANY (+RW +ZI) 63 | * (+RO-CODE) 64 | * (+XO) 65 | } 66 | 67 | RW_IRAM_NO_INIT +0 UNINIT { 68 | .ANY (.bss.noinit) 69 | } 70 | 71 | } 72 | 73 | -------------------------------------------------------------------------------- /project/mdk/RTE/Acceleration/arm_2d_cfg.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009-2022 Arm Limited. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #ifndef __ARM_2D_USER_CFG_H__ 20 | #define __ARM_2D_USER_CFG_H__ 21 | 22 | /*============================ INCLUDES ======================================*/ 23 | 24 | #if defined(_RTE_) 25 | # include "RTE_Components.h" 26 | #endif 27 | 28 | #ifdef __cplusplus 29 | extern "C" { 30 | #endif 31 | 32 | /*============================ MACROS ========================================*/ 33 | /*============================ MACROFIED FUNCTIONS ===========================*/ 34 | 35 | 36 | //-------- <<< Use Configuration Wizard in Context Menu >>> ----------------- 37 | // 38 | // Arm-2D General Configurations 39 | // ======================= 40 | // 41 | // Enable Asynchronous Programmers' model support 42 | // Note that if you don't have any hardware accelerator, disable this feature can reduce code size and gain a small performance uplift. 43 | // This feature is enabled by default. 44 | #ifndef __ARM_2D_HAS_ASYNC__ 45 | # define __ARM_2D_HAS_ASYNC__ 0 46 | #endif 47 | 48 | // Enable anti-alias support for all tranform operations. 49 | // Note that enabling this feature suffers a non-negligible performance drop. 50 | // This feature is disabled by default. 51 | #ifndef __ARM_2D_HAS_ANTI_ALIAS_TRANSFORM__ 52 | # define __ARM_2D_HAS_ANTI_ALIAS_TRANSFORM__ 1 53 | #endif 54 | 55 | // Enable support for accessing individual colour channels 56 | // Note that enabling this feature will add the support for a special colour type: ARM_2D_CHANNEL_8in32 57 | // This feature is disabled by default to save code size 58 | #ifndef __ARM_2D_CFG_SUPPORT_COLOUR_CHANNEL_ACCESS__ 59 | # define __ARM_2D_CFG_SUPPORT_COLOUR_CHANNEL_ACCESS__ 0 60 | #endif 61 | 62 | // Enable ccca8888(ARGB8888) implicit conversion 63 | // This feature is disabled by default to save code size 64 | #ifndef __ARM_2D_CFG_SUPPORT_CCCA8888_IMPLICIT_CONVERSION__ 65 | # define __ARM_2D_CFG_SUPPORT_CCCA8888_IMPLICIT_CONVERSION__ 0 66 | #endif 67 | 68 | // Improve the Quality of IIR Blur 69 | // Note that enabling this feature will half the performance of IIR Blur and only works correctly in Full framebuffer mode 70 | // This feature is disabled by default to improve performance 71 | #ifndef __ARM_2D_CFG_USE_IIR_BLUR_REVERSE_PATH__ 72 | # define __ARM_2D_CFG_USE_IIR_BLUR_REVERSE_PATH__ 1 73 | #endif 74 | // 75 | 76 | // Log and Debug 77 | // ======================= 78 | // Enable Log 79 | // This feature is disabled by default. 80 | #ifndef __ARM_2D_CFG_ENABLE_LOG__ 81 | # define __ARM_2D_CFG_ENABLE_LOG__ 0 82 | #endif 83 | 84 | // The terminal support colour 85 | // The terminal is compatible with VT100 and support colour display. This feature is disabled by default. 86 | #ifndef __ARM_2D_CFG_LOG_OUTPUT_SUPPORT_COLOUR__ 87 | # define __ARM_2D_CFG_LOG_OUTPUT_SUPPORT_COLOUR__ 0 88 | #endif 89 | 90 | // The maximum length of log string <64-65535> 91 | // The number of bytes requested from heap during log output 92 | // Default: 256 93 | #ifndef __ARM_2D_LOG_MAX_STRING_LEN__ 94 | # define __ARM_2D_LOG_MAX_STRING_LEN__ 256 95 | #endif 96 | 97 | /* The filter of log channels. Please comment the channels that you want to mask. 98 | */ 99 | #ifndef __ARM_2D_LOG_CHANNEL_MASK_FILTER__ 100 | # define __ARM_2D_LOG_CHANNEL_MASK_FILTER__ \ 101 | ( ARM_2D_LOG_CHN_TYPE_USER \ 102 | | ARM_2D_LOG_CHN_TYPE_INFO \ 103 | | ARM_2D_LOG_CHN_TYPE_WARNING \ 104 | | ARM_2D_LOG_CHN_TYPE_ERROR \ 105 | | ARM_2D_LOG_CHN_PIPELINE \ 106 | | ARM_2D_LOG_CHN_OPCODE \ 107 | | ARM_2D_LOG_CHN_HELPER \ 108 | | ARM_2D_LOG_CHN_HELPER_PFB \ 109 | | ARM_2D_LOG_CHN_SCENE_PLAYER \ 110 | | ARM_2D_LOG_CHN_DIRTY_REGION_OPTIMISATION \ 111 | | ARM_2D_LOG_CHN_STATISTICS \ 112 | | ARM_2D_LOG_CHN_CONTROLS \ 113 | | ARM_2D_LOG_CHN_APP) 114 | #endif 115 | 116 | // Enable The Layout Debug Mode 117 | // Arm-2D will mark the layout areas. 118 | #ifndef __ARM_2D_HELPER_CFG_LAYOUT_DEBUG_MODE__ 119 | # define __ARM_2D_HELPER_CFG_LAYOUT_DEBUG_MODE__ 0 120 | #endif 121 | 122 | // 123 | 124 | // Patches for improving performance 125 | // ======================= 126 | // 127 | // Do NOT treat alpha value 255 as completely opaque in mask related operations 128 | // When define this macro, alpha value 0xFF will not be treated as opaque in mask related operations and you can barely see the background. Defining this macro improves performance. 129 | //#define __ARM_2D_CFG_UNSAFE_IGNORE_ALPHA_255_COMPENSATION__ 130 | // 131 | 132 | // Ignore calibrartion for small angles in transform operations 133 | // This option is used to speed up M-cores without DSP support. It skips saturation in the QADD/QDADD/QDSUB involved in the rotation. The chances of overflow remain low as elements involved are using non-accumulating Q15.16 format and integer parts are in the range of the screen size providing enough margin. 134 | //#define __ARM_2D_CFG_UNSAFE_IGNORE_CALIB_IN_TRANSFORM__ 135 | // 136 | 137 | // Ignore satuation protection in fixed-point operations 138 | // This option is used to remove calibration in angle computations to gain a better performance, small error might be noticible for angles like 90, 180, 270 etc. 139 | //#define __ARM_2D_CFG_UNSAFE_NO_SATURATION_IN_FIXED_POINT__ 140 | // 141 | 142 | 143 | // Optimize the scaler version of transform operations for pointer-like resources 144 | // This feature is enabled by default. There is no guarantee that the performance will increase or decrease. It is all depends your applications. In most of the case, enabling it helps. 145 | // This feature has no meaning when the anti-alias transform is disabled or the helium acceleration is available. 146 | #ifndef __ARM_2D_CFG_OPTIMIZE_FOR_POINTER_LIKE_SHAPES_IN_TRANSFORM__ 147 | # define __ARM_2D_CFG_OPTIMIZE_FOR_POINTER_LIKE_SHAPES_IN_TRANSFORM__ 1 148 | #endif 149 | 150 | // Optimize the scaler version of transform operations for hollow out masks 151 | // This feature is disabled by default. There is no guarantee that the performance will increase or decrease. It is all depends your applications. If your application uses a lot of hollow out masks, it might help. 152 | // This feature has no meaning when the anti-alias transform is disabled or the helium acceleration is available. 153 | #ifndef __ARM_2D_CFG_OPTIMIZE_FOR_HOLLOW_OUT_MASK_IN_TRANSFORM__ 154 | # define __ARM_2D_CFG_OPTIMIZE_FOR_HOLLOW_OUT_MASK_IN_TRANSFORM__ 0 155 | #endif 156 | 157 | // 158 | 159 | 160 | // Extra Components 161 | // ======================= 162 | // 163 | #ifndef __GLCD_CFG_COLOUR_DEPTH__ 164 | // Select the screen colour depth 165 | // <8=> 8 Bits 166 | // <16=> 16Bits 167 | // <32=> 32Bits 168 | // The colour depth of your LCD 169 | // Default: 16 170 | # define __GLCD_CFG_COLOUR_DEPTH__ 16 171 | #endif 172 | 173 | // The size of the LCD printf text buffer <16-65535> 174 | // The text buffer size for the lcd printf service. It determins how many character you can use in one printf string. 175 | #ifndef __LCD_PRINTF_CFG_TEXT_BUFFER_SIZE__ 176 | # define __LCD_PRINTF_CFG_TEXT_BUFFER_SIZE__ 64 177 | #endif 178 | 179 | // Benchmark 180 | 181 | // Width of the screen <8-32767> 182 | // The width of your screen for running benchmark 183 | // Default: 320 184 | #ifndef __GLCD_CFG_SCEEN_WIDTH__ 185 | # define __GLCD_CFG_SCEEN_WIDTH__ 240 186 | #endif 187 | 188 | // Height of the screen <8-32767> 189 | // The height of your screen for running benchmark 190 | // Default: 240 191 | #ifndef __GLCD_CFG_SCEEN_HEIGHT__ 192 | # define __GLCD_CFG_SCEEN_HEIGHT__ 240 193 | #endif 194 | 195 | // Number of iterations <1-2000> 196 | // run number of iterations in arm-2d benchmark before calculating the result. 197 | #ifndef ITERATION_CNT 198 | # define ITERATION_CNT 1000 199 | #endif 200 | 201 | // Use Tiny mode to run benchmark 202 | // Enable this mode to reduce the benchmark memory footprint (removing background picture etc.) 203 | // This feature is disabled by default. 204 | #ifndef __ARM_2D_CFG_BENCHMARK_TINY_MODE__ 205 | # define __ARM_2D_CFG_BENCHMARK_TINY_MODE__ 0 206 | #endif 207 | 208 | // Enable Stopwatch mode in the Benchmark:Watch-panel 209 | // Only update the second-hand (i.e. red pointer) every second in the watch-panel demo 210 | // This feature is disabled by default. 211 | #ifndef __ARM_2D_CFG_WATCH_PANEL_STOPWATCH_MODE__ 212 | # define __ARM_2D_CFG_WATCH_PANEL_STOPWATCH_MODE__ 0 213 | #endif 214 | 215 | // Enable the nebula effect mode in the Benchmark:Watch-panel 216 | // This feature is disabled by default and it is only available in the Tiny mode. 217 | #ifndef __ARM_2D_CFG_BENCHMARK_WATCH_PANEL_USE_NEBULA__ 218 | # define __ARM_2D_CFG_BENCHMARK_WATCH_PANEL_USE_NEBULA__ 0 219 | #endif 220 | 221 | // Exit benchmark when finished 222 | // Exit the arm_2d_run_benchmark() after running specified iterations 223 | // This feature is disabled by default. 224 | #ifndef __ARM_2D_CFG_BENCHMARK_EXIT_WHEN_FINISH__ 225 | # define __ARM_2D_CFG_BENCHMARK_EXIT_WHEN_FINISH__ 0 226 | #endif 227 | 228 | // 229 | // 230 | 231 | // <<< end of configuration section >>> 232 | 233 | 234 | #if defined(__RP2040_USE_LCD_TOUCH_1IN28__) && __RP2040_USE_LCD_TOUCH_1IN28__ 235 | # define __DISP0_CFG_SWAP_RGB16_HIGH_AND_LOW_BYTES__ 1 236 | #endif 237 | 238 | /*============================ TYPES =========================================*/ 239 | /*============================ GLOBAL VARIABLES ==============================*/ 240 | /*============================ LOCAL VARIABLES ===============================*/ 241 | /*============================ PROTOTYPES ====================================*/ 242 | 243 | 244 | #ifdef __cplusplus 245 | } 246 | #endif 247 | 248 | #endif 249 | -------------------------------------------------------------------------------- /project/mdk/RTE/Acceleration/arm_2d_disp_adapter_0.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009-2024 Arm Limited. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #ifndef __ARM_2D_DISP_ADAPTER0_H__ 20 | #define __ARM_2D_DISP_ADAPTER0_H__ 21 | 22 | #include "arm_2d.h" 23 | 24 | #ifdef RTE_Acceleration_Arm_2D_Helper_Disp_Adapter0 25 | 26 | #include "arm_2d_helper_scene.h" 27 | #include "__common.h" 28 | 29 | #ifdef __cplusplus 30 | extern "C" { 31 | #endif 32 | 33 | #if defined(__clang__) 34 | # pragma clang diagnostic push 35 | # pragma clang diagnostic ignored "-Wunknown-warning-option" 36 | # pragma clang diagnostic ignored "-Wreserved-identifier" 37 | # pragma clang diagnostic ignored "-Wdeclaration-after-statement" 38 | # pragma clang diagnostic ignored "-Wpadded" 39 | # pragma clang diagnostic ignored "-Wgnu-zero-variadic-macro-arguments" 40 | #endif 41 | 42 | /*============================ INCLUDES ======================================*/ 43 | /*============================ MACROS ========================================*/ 44 | 45 | //-------- <<< Use Configuration Wizard in Context Menu >>> ----------------- 46 | // 47 | // Select the screen colour depth 48 | // <8=> 8 Bits 49 | // <16=> 16Bits 50 | // <32=> 32Bits 51 | // The colour depth of your screen 52 | #ifndef __DISP0_CFG_COLOUR_DEPTH__ 53 | # define __DISP0_CFG_COLOUR_DEPTH__ 16 54 | #endif 55 | 56 | // Width of the screen <8-32767> 57 | // The width of your screen 58 | // Default: 320 59 | #ifndef __DISP0_CFG_SCEEN_WIDTH__ 60 | # define __DISP0_CFG_SCEEN_WIDTH__ 240 61 | #endif 62 | 63 | // Height of the screen <8-32767> 64 | // The height of your screen 65 | // Default: 240 66 | #ifndef __DISP0_CFG_SCEEN_HEIGHT__ 67 | # define __DISP0_CFG_SCEEN_HEIGHT__ 240 68 | #endif 69 | 70 | /* 71 | ARM_SCREEN_NO_ROTATION 0 72 | ARM_SCREEN_ROTATE_90 1 73 | ARM_SCREEN_ROTATE_180 2 74 | ARM_SCREEN_ROTATE_270 3 75 | */ 76 | 77 | // Rotate the Screen 78 | // <0=> NO Rotation 79 | // <1=> 90 Degree 80 | // <2=> 180 Degree 81 | // <3=> 270 Degree 82 | // Rotate the Screen for specified degrees. 83 | // NOTE: This is extremely slow. Please avoid using it whenever it is possible. 84 | #ifndef __DISP0_CFG_ROTATE_SCREEN__ 85 | # define __DISP0_CFG_ROTATE_SCREEN__ 0 86 | #endif 87 | 88 | // Width of the PFB block 89 | // The width of your PFB block size used in disp0 90 | #ifndef __DISP0_CFG_PFB_BLOCK_WIDTH__ 91 | # define __DISP0_CFG_PFB_BLOCK_WIDTH__ 240 92 | #endif 93 | 94 | // Height of the PFB block 95 | // The height of your PFB block size used in disp0 96 | #ifndef __DISP0_CFG_PFB_BLOCK_HEIGHT__ 97 | # define __DISP0_CFG_PFB_BLOCK_HEIGHT__ 24 98 | #endif 99 | 100 | // Width Alignment of generated PFBs 101 | // <0=> 1 pixel 102 | // <1=> 2 pixel 103 | // <2=> 4 pixel 104 | // <3=> 8 pixel 105 | // <4=> 16 pixel 106 | // <5=> 32 pixel 107 | // <6=> 64 pixel 108 | // <7=> 128 pixel 109 | // Make sure the x and width of the PFB is always aligned to 2^n pixels 110 | #ifndef __DISP0_CFG_PFB_PIXEL_ALIGN_WIDTH__ 111 | # define __DISP0_CFG_PFB_PIXEL_ALIGN_WIDTH__ 1 112 | #endif 113 | 114 | // Height Alignment of generated PFBs 115 | // <0=> 1 pixel 116 | // <1=> 2 pixel 117 | // <2=> 4 pixel 118 | // <3=> 8 pixel 119 | // <4=> 16 pixel 120 | // <5=> 32 pixel 121 | // <6=> 64 pixel 122 | // <7=> 128 pixel 123 | // Make sure the y and height of the PFB is always aligned to 2^n pixels 124 | #ifndef __DISP0_CFG_PFB_PIXEL_ALIGN_HEIGHT__ 125 | # define __DISP0_CFG_PFB_PIXEL_ALIGN_HEIGHT__ 0 126 | #endif 127 | 128 | // PFB Block Count <1-65535> 129 | // The number of blocks in the PFB pool. 130 | #ifndef __DISP0_CFG_PFB_HEAP_SIZE__ 131 | # define __DISP0_CFG_PFB_HEAP_SIZE__ 1 132 | #endif 133 | 134 | // Number of iterations <0-2000> 135 | // run number of iterations before calculate the FPS. 136 | #ifndef __DISP0_CFG_ITERATION_CNT__ 137 | # define __DISP0_CFG_ITERATION_CNT__ 30 138 | #endif 139 | 140 | // FPS Calculation Mode 141 | // <0=> Render-Only FPS 142 | // <1=> Real FPS 143 | // Decide the meaning of the real time FPS display 144 | #ifndef __DISP0_CFG_FPS_CACULATION_MODE__ 145 | # define __DISP0_CFG_FPS_CACULATION_MODE__ 1 146 | #endif 147 | 148 | // Enable Dirty Region Debug Mode 149 | // Draw dirty regions on the screen for debug. 150 | #ifndef __DISP0_CFG_DEBUG_DIRTY_REGIONS__ 151 | # define __DISP0_CFG_DEBUG_DIRTY_REGIONS__ 0 152 | #endif 153 | 154 | // Enable Dirty Region Optimization Service 155 | // Optimize dirty regions to avoid fresh overlapped areas 156 | #ifndef __DISP0_CFG_OPTIMIZE_DIRTY_REGIONS__ 157 | # define __DISP0_CFG_OPTIMIZE_DIRTY_REGIONS__ 1 158 | #endif 159 | 160 | // Dirty Region Pool Size <4-255> 161 | // The number of dirty region items available for the dirty region optimization service 162 | #ifndef __DISP0_CFG_DIRTY_REGION_POOL_SIZE__ 163 | # define __DISP0_CFG_DIRTY_REGION_POOL_SIZE__ 8 164 | #endif 165 | 166 | // Swap the high and low bytes 167 | // Swap the high and low bytes of the 16bit-pixels 168 | #ifndef __DISP0_CFG_SWAP_RGB16_HIGH_AND_LOW_BYTES__ 169 | # define __DISP0_CFG_SWAP_RGB16_HIGH_AND_LOW_BYTES__ 0 170 | #endif 171 | 172 | // Enable the helper service for Asynchronous Flushing 173 | // Please select this option when using asynchronous flushing, e.g. DMA + ISR 174 | #ifndef __DISP0_CFG_ENABLE_ASYNC_FLUSHING__ 175 | # define __DISP0_CFG_ENABLE_ASYNC_FLUSHING__ 0 176 | #endif 177 | 178 | // Enable the helper service for 3FB (LCD Direct Mode) 179 | // You can select this option when your LCD controller supports direct mode 180 | #ifndef __DISP0_CFG_ENABLE_3FB_HELPER_SERVICE__ 181 | # define __DISP0_CFG_ENABLE_3FB_HELPER_SERVICE__ 0 182 | #endif 183 | 184 | // Disable the default scene 185 | // Remove the default scene for this display adapter. We highly recommend you to disable the default scene when creating real applications. 186 | #ifndef __DISP0_CFG_DISABLE_DEFAULT_SCENE__ 187 | # define __DISP0_CFG_DISABLE_DEFAULT_SCENE__ 0 188 | #endif 189 | 190 | // Navigation Layer Mode 191 | // <0=> Disable Navigation Layer 192 | // <1=> Normal Mode (Bottom) 193 | // <2=> Tiny Mode (Bottom Centre) 194 | // Configure the default navigation layer of this display adapter. 195 | // NOTE: Disable the navigation layer will also remove the real-time FPS display. 196 | #ifndef __DISP0_CFG_NAVIGATION_LAYER_MODE__ 197 | # define __DISP0_CFG_NAVIGATION_LAYER_MODE__ 2 198 | #endif 199 | 200 | // Enable Console 201 | // Add a simple console to the display adapter in a floating window. 202 | // This feature is disabled by default. 203 | #ifndef __DISP0_CFG_USE_CONSOLE__ 204 | # define __DISP0_CFG_USE_CONSOLE__ 0 205 | #endif 206 | 207 | // Console Input Buffer Size 208 | // The size of console input buffer, 0 means no input buffer 209 | #ifndef __DISP0_CFG_CONSOLE_INPUT_BUFFER__ 210 | # define __DISP0_CFG_CONSOLE_INPUT_BUFFER__ 255 211 | #endif 212 | 213 | // Console Display Time in ms <1000-0xFFFFFFFF> 214 | // The time before the console disappear for each content update. 215 | #ifndef __DISP0_CFG_CONSOLE_DISPALY_TIME__ 216 | # define __DISP0_CFG_CONSOLE_DISPALY_TIME__ 3000 217 | #endif 218 | 219 | // Maximum number of Virtual Resources used per API 220 | // <0=> NO Virtual Resource 221 | // <1=> 1 Per API 222 | // <2=> 2 Per API 223 | // <3=> 3 Per API 224 | // Introduce a helper service for loading virtual resources. 225 | // This feature is disabled by default. 226 | #ifndef __DISP0_CFG_VIRTUAL_RESOURCE_HELPER__ 227 | # define __DISP0_CFG_VIRTUAL_RESOURCE_HELPER__ 0 228 | #endif 229 | 230 | // Use heap to allocate buffer in the virtual resource helper service 231 | // Use malloc and free in the virtual resource helper service. When disabled, a static buffer in the size of current display adapter PFB will be used. 232 | // This feature is disabled by default. 233 | #ifndef __DISP0_CFG_USE_HEAP_FOR_VIRTUAL_RESOURCE_HELPER__ 234 | # define __DISP0_CFG_USE_HEAP_FOR_VIRTUAL_RESOURCE_HELPER__ 0 235 | #endif 236 | // <<< end of configuration section >>> 237 | 238 | #ifndef __DISP0_COLOUR_FORMAT__ 239 | # if __DISP0_CFG_COLOUR_DEPTH__ == 8 240 | # define __DISP0_COLOUR_FORMAT__ ARM_2D_COLOUR_GRAY8 241 | # elif __DISP0_CFG_COLOUR_DEPTH__ == 16 242 | # define __DISP0_COLOUR_FORMAT__ ARM_2D_COLOUR_RGB565 243 | # elif __DISP0_CFG_COLOUR_DEPTH__ == 32 244 | # define __DISP0_COLOUR_FORMAT__ ARM_2D_COLOUR_CCCN888 245 | # endif 246 | #endif 247 | 248 | /*============================ MACROFIED FUNCTIONS ===========================*/ 249 | 250 | #if __DISP0_CFG_VIRTUAL_RESOURCE_HELPER__ 251 | #define disp_adapter0_impl_vres(__COLOUR_FORMAT, __WIDTH, __HEIGHT,...) \ 252 | { \ 253 | .tTile = { \ 254 | .tRegion = { \ 255 | .tSize = { \ 256 | .iWidth = (__WIDTH), \ 257 | .iHeight =(__HEIGHT), \ 258 | }, \ 259 | }, \ 260 | .tInfo = { \ 261 | .bIsRoot = true, \ 262 | .bHasEnforcedColour = true, \ 263 | .bVirtualResource = true, \ 264 | .tColourInfo = { \ 265 | .chScheme = (__COLOUR_FORMAT), \ 266 | }, \ 267 | }, \ 268 | }, \ 269 | .Load = &__disp_adapter0_vres_asset_loader, \ 270 | .Depose = &__disp_adapter0_vres_buffer_deposer, \ 271 | __VA_ARGS__ \ 272 | } 273 | #endif 274 | 275 | #define disp_adapter0_task(...) \ 276 | ({ \ 277 | static bool ARM_2D_SAFE_NAME(s_bRefreshLCD) = false; \ 278 | arm_fsm_rt_t ARM_2D_SAFE_NAME(ret) = arm_fsm_rt_on_going; \ 279 | if (!__ARM_VA_NUM_ARGS(__VA_ARGS__)) { \ 280 | ARM_2D_SAFE_NAME(ret) = __disp_adapter0_task(); \ 281 | } else { \ 282 | if (!ARM_2D_SAFE_NAME(s_bRefreshLCD)) { \ 283 | /* lock framerate */ \ 284 | if (arm_2d_helper_is_time_out(1000 / (1000,##__VA_ARGS__))) { \ 285 | ARM_2D_SAFE_NAME(s_bRefreshLCD) = true; \ 286 | } \ 287 | } else { \ 288 | ARM_2D_SAFE_NAME(ret) = __disp_adapter0_task(); \ 289 | if (arm_fsm_rt_cpl == ARM_2D_SAFE_NAME(ret)) { \ 290 | ARM_2D_SAFE_NAME(s_bRefreshLCD) = false; \ 291 | } \ 292 | } \ 293 | }; \ 294 | ARM_2D_SAFE_NAME(ret);}) 295 | 296 | /*============================ TYPES =========================================*/ 297 | /*============================ GLOBAL VARIABLES ==============================*/ 298 | ARM_NOINIT 299 | extern 300 | arm_2d_scene_player_t DISP0_ADAPTER; 301 | 302 | /*============================ PROTOTYPES ====================================*/ 303 | 304 | extern 305 | void disp_adapter0_init(void); 306 | 307 | extern 308 | arm_fsm_rt_t __disp_adapter0_task(void); 309 | 310 | 311 | #if __DISP0_CFG_VIRTUAL_RESOURCE_HELPER__ 312 | /*! 313 | * \brief a method to load a specific part of an image 314 | * \note It is NOT an API for users to call, plese leave it alone 315 | * 316 | * \param[in] pTarget a reference of an user object 317 | * \param[in] ptVRES a reference of this virtual resource 318 | * \param[in] ptRegion the target region of the image 319 | * \return intptr_t the address of a resource buffer which holds the content 320 | */ 321 | intptr_t __disp_adapter0_vres_asset_loader ( 322 | uintptr_t pTarget, 323 | arm_2d_vres_t *ptVRES, 324 | arm_2d_region_t *ptRegion); 325 | 326 | /*! 327 | * \brief a method to despose the buffer 328 | * \note It is NOT an API for users to call, plese leave it alone 329 | * 330 | * \param[in] pTarget a reference of an user object 331 | * \param[in] ptVRES a reference of this virtual resource 332 | * \param[in] pBuffer the target buffer 333 | */ 334 | void __disp_adapter0_vres_buffer_deposer ( uintptr_t pTarget, 335 | arm_2d_vres_t *ptVRES, 336 | intptr_t pBuffer ); 337 | 338 | /*! 339 | * \brief A user implemented function to return the address for specific asset 340 | * stored in external memory, e.g. SPI Flash 341 | * \note You MUST provide an implementation when 342 | * __DISP0_CFG_VIRTUAL_RESOURCE_HELPER__ is enabled(1) 343 | * 344 | * \param[in] pObj an pointer of user defined object, it is used for OOC 345 | * \note You can ignore pObj if you don't care/don't use OOC 346 | * 347 | * \param[in] ptVRES the target virtual resource object 348 | * \return uintptr_t the address of the target asset in external memory 349 | */ 350 | extern 351 | uintptr_t __disp_adapter0_vres_get_asset_address( 352 | uintptr_t pObj, 353 | arm_2d_vres_t *ptVRES); 354 | 355 | /*! 356 | * \brief A user implemented function to copy content from external memory 357 | * (e.g. SPI Flash) to a local buffer with specified address and size. 358 | * 359 | * \note You MUST provide an implementation when 360 | * __DISP0_CFG_VIRTUAL_RESOURCE_HELPER__ is enabled(1) 361 | * 362 | * \param[in] pObj an pointer of user defined object, it is used for OOC 363 | * \note You can ignore pObj if you don't care/don't use OOC 364 | * 365 | * \param[in] pBuffer the address of the local buffer 366 | * \param[in] pAddress the address in the external memory 367 | * \param[in] nSizeInByte number of bytes to read 368 | */ 369 | extern 370 | void __disp_adapter0_vres_read_memory( intptr_t pObj, 371 | void *pBuffer, 372 | uintptr_t pAddress, 373 | size_t nSizeInByte); 374 | 375 | #endif 376 | 377 | #if __DISP0_CFG_ENABLE_ASYNC_FLUSHING__ 378 | 379 | # if __DISP0_CFG_ENABLE_3FB_HELPER_SERVICE__ 380 | 381 | /*! 382 | * \brief An user implemented interface for DMA memory-to-memory copy. 383 | * You should implement an ISR for copy-complete event and call 384 | * disp_adapter0_insert_dma_copy_complete_event_handler() or 385 | * arm_2d_helper_3fb_report_dma_copy_complete() to notify the 386 | * 3FB (direct mode) helper service. 387 | * 388 | * \param[in] ptThis the helper service control block 389 | * \param[in] pObj the address of the user object 390 | * \param[in] pnSource the source address of the memory block 391 | * \param[in] pnTarget the target address 392 | * \param[in] nDataItemCount the number of date items 393 | * \param[in] chDataItemSize the size of each data item 394 | */ 395 | extern 396 | void __disp_adapter0_request_dma_copy( arm_2d_helper_3fb_t *ptThis, 397 | void *pObj, 398 | uintptr_t pnSource, 399 | uintptr_t pnTarget, 400 | uint32_t nDataItemCount, 401 | uint_fast8_t chDataItemSize); 402 | 403 | /*! 404 | * \brief An user implemented interface for 2D-Copy. 405 | * \param[in] pnSource the source image address 406 | * \param[in] wSourceStride the stride of the source image 407 | * \param[in] pnTarget the address in the target framebuffer 408 | * \param[in] wTargetStride the stride of the target framebuffer 409 | * \param[in] iWidth the safe width of the source image 410 | * \param[in] iHeight the safe height of the source image 411 | * \retval true the 2D copy is complete when leaving this function 412 | * \retval false An async 2D copy request is sent to the DMA 413 | * 414 | * \note if false is replied, you have to call 415 | * disp_adapter0_insert_2d_copy_complete_event_handler() to report 416 | * the completion of the 2d-copy. 417 | */ 418 | bool __disp_adapter0_request_2d_copy( arm_2d_helper_3fb_t *ptThis, 419 | void *pObj, 420 | uintptr_t pnSource, 421 | uint32_t wSourceStride, 422 | uintptr_t pnTarget, 423 | uint32_t wTargetStride, 424 | int16_t iWidth, 425 | int16_t iHeight, 426 | uint_fast8_t chBytePerPixel ); 427 | 428 | /*! 429 | * \brief the handler for the 2d copy complete event. 430 | * \note When both __DISP0_CFG_ENABLE_ASYNC_FLUSHING__ and 431 | * __DISP0_CFG_ENABLE_3FB_HELPER_SERVICE__ is set to '1', user 432 | * MUST call this function to notify the PFB helper that the previous 433 | * asynchronouse 2d copy is complete. 434 | * \note When people using DMA+ISR to offload CPU, this fucntion is called in 435 | * the DMA transfer complete ISR. 436 | */ 437 | extern 438 | void disp_adapter0_insert_2d_copy_complete_event_handler(void); 439 | 440 | /*! 441 | * \brief the handler for the dma copy complete event. 442 | * \note When both __DISP0_CFG_ENABLE_ASYNC_FLUSHING__ and 443 | * __DISP0_CFG_ENABLE_3FB_HELPER_SERVICE__ is set to '1', user 444 | * MUST call this function to notify the PFB helper that the previous 445 | * dma copy is complete. 446 | * \note When people using DMA+ISR to offload CPU, this fucntion is called in 447 | * the DMA transfer complete ISR. 448 | */ 449 | extern 450 | void disp_adapter0_insert_dma_copy_complete_event_handler(void); 451 | 452 | # else 453 | 454 | /*! 455 | * \brief It is an user implemented function that request an LCD flushing in 456 | * asynchronous manner. 457 | * \note User MUST implement this function when 458 | * __DISP0_CFG_ENABLE_ASYNC_FLUSHING__ is set to '1' 459 | * 460 | * \param[in] pTarget an user specified object address 461 | * \param[in] bIsNewFrame whether this flushing request is the first iteration 462 | * of a new frame. 463 | * \param[in] iX the x coordinate of a flushing window in the target screen 464 | * \param[in] iY the y coordinate of a flushing window in the target screen 465 | * \param[in] iWidth the width of a flushing window 466 | * \param[in] iHeight the height of a flushing window 467 | * \param[in] pBuffer the frame buffer address 468 | */ 469 | extern void __disp_adapter0_request_async_flushing( 470 | void *pTarget, 471 | bool bIsNewFrame, 472 | int16_t iX, 473 | int16_t iY, 474 | int16_t iWidth, 475 | int16_t iHeight, 476 | const COLOUR_INT *pBuffer); 477 | 478 | 479 | /*! 480 | * \brief the handler for the asynchronous flushing complete event. 481 | * \note When __DISP0_CFG_ENABLE_ASYNC_FLUSHING__ is set to '1', user 482 | * MUST call this function to notify the PFB helper that the previous 483 | * asynchronous flushing is complete. 484 | * \note When people using DMA+ISR to offload CPU, this fucntion is called in 485 | * the DMA transfer complete ISR. 486 | */ 487 | extern 488 | void disp_adapter0_insert_async_flushing_complete_event_handler(void); 489 | 490 | # endif 491 | #endif 492 | 493 | #if __DISP0_CFG_ENABLE_3FB_HELPER_SERVICE__ 494 | 495 | /*! 496 | * \brief get a pointer for flushing 497 | * \return void * the address of a framebuffer 498 | * 499 | * \note please only call this function when on vsync event. 500 | */ 501 | extern 502 | void *disp_adapter0_3fb_get_flush_pointer(void); 503 | 504 | #endif 505 | 506 | 507 | #if __DISP0_CFG_USE_CONSOLE__ 508 | extern 509 | ARM_NONNULL(1) 510 | int disp_adapter0_printf(const char *format, ...); 511 | 512 | extern 513 | bool disp_adapter0_putchar(uint8_t chChar); 514 | #else 515 | # define disp_adapter0_printf(__format_string, ...) 516 | # define disp_adapter0_putchar(...) (true) 517 | #endif 518 | 519 | #if defined(__clang__) 520 | # pragma clang diagnostic pop 521 | #endif 522 | 523 | #ifdef __cplusplus 524 | } 525 | #endif 526 | 527 | #endif 528 | 529 | #endif 530 | -------------------------------------------------------------------------------- /project/mdk/RTE/Acceleration/arm_2d_scene_gas_gauge.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009-2022 Arm Limited. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | /*============================ INCLUDES ======================================*/ 20 | 21 | #include "arm_2d.h" 22 | 23 | #if defined(RTE_Acceleration_Arm_2D_Helper_PFB) 24 | 25 | #define __USER_SCENE_GAS_GAUGE_IMPLEMENT__ 26 | #include "arm_2d_scenes.h" 27 | 28 | #include "arm_2d_helper.h" 29 | #include "arm_2d_example_controls.h" 30 | 31 | #include "arm_2d_scene_gas_gauge.h" 32 | 33 | #include 34 | #include 35 | 36 | #if defined(__clang__) 37 | # pragma clang diagnostic push 38 | # pragma clang diagnostic ignored "-Wunknown-warning-option" 39 | # pragma clang diagnostic ignored "-Wreserved-identifier" 40 | # pragma clang diagnostic ignored "-Wsign-conversion" 41 | # pragma clang diagnostic ignored "-Wpadded" 42 | # pragma clang diagnostic ignored "-Wcast-qual" 43 | # pragma clang diagnostic ignored "-Wcast-align" 44 | # pragma clang diagnostic ignored "-Wmissing-field-initializers" 45 | # pragma clang diagnostic ignored "-Wgnu-zero-variadic-macro-arguments" 46 | # pragma clang diagnostic ignored "-Wmissing-prototypes" 47 | # pragma clang diagnostic ignored "-Wunused-variable" 48 | # pragma clang diagnostic ignored "-Wgnu-statement-expression" 49 | # pragma clang diagnostic ignored "-Wdeclaration-after-statement" 50 | # pragma clang diagnostic ignored "-Wunused-function" 51 | # pragma clang diagnostic ignored "-Wmissing-declarations" 52 | #elif __IS_COMPILER_ARM_COMPILER_5__ 53 | # pragma diag_suppress 64,177 54 | #elif __IS_COMPILER_IAR__ 55 | # pragma diag_suppress=Pa089,Pe188,Pe177,Pe174 56 | #elif __IS_COMPILER_GCC__ 57 | # pragma GCC diagnostic push 58 | # pragma GCC diagnostic ignored "-Wformat=" 59 | # pragma GCC diagnostic ignored "-Wpedantic" 60 | # pragma GCC diagnostic ignored "-Wunused-function" 61 | # pragma GCC diagnostic ignored "-Wunused-variable" 62 | # pragma GCC diagnostic ignored "-Wunused-value" 63 | #endif 64 | 65 | /*============================ MACROS ========================================*/ 66 | 67 | #if __GLCD_CFG_COLOUR_DEPTH__ == 8 68 | 69 | # define c_tileCMSISLogo c_tileCMSISLogoGRAY8 70 | 71 | #elif __GLCD_CFG_COLOUR_DEPTH__ == 16 72 | 73 | # define c_tileCMSISLogo c_tileCMSISLogoRGB565 74 | 75 | #elif __GLCD_CFG_COLOUR_DEPTH__ == 32 76 | 77 | # define c_tileCMSISLogo c_tileCMSISLogoCCCA8888 78 | #else 79 | # error Unsupported colour depth! 80 | #endif 81 | 82 | /*============================ MACROFIED FUNCTIONS ===========================*/ 83 | #undef this 84 | #define this (*ptThis) 85 | 86 | /*============================ TYPES =========================================*/ 87 | /*============================ GLOBAL VARIABLES ==============================*/ 88 | 89 | extern const arm_2d_tile_t c_tileCMSISLogo; 90 | extern const arm_2d_tile_t c_tileCMSISLogoMask; 91 | extern const arm_2d_tile_t c_tileCMSISLogoA2Mask; 92 | extern const arm_2d_tile_t c_tileCMSISLogoA4Mask; 93 | 94 | /*============================ PROTOTYPES ====================================*/ 95 | /*============================ LOCAL VARIABLES ===============================*/ 96 | /*============================ IMPLEMENTATION ================================*/ 97 | 98 | 99 | static void __on_scene_gas_gauge_depose(arm_2d_scene_t *ptScene) 100 | { 101 | user_scene_gas_gauge_t *ptThis = (user_scene_gas_gauge_t *)ptScene; 102 | ARM_2D_UNUSED(ptThis); 103 | 104 | ptScene->ptPlayer = NULL; 105 | 106 | /* reset timestamp */ 107 | arm_foreach(int64_t,this.lTimestamp, ptItem) { 108 | *ptItem = 0; 109 | } 110 | 111 | ARM_2D_OP_DEPOSE(this.tBlurOP); 112 | 113 | if (!this.bUserAllocated) { 114 | __arm_2d_free_scratch_memory(ARM_2D_MEM_TYPE_UNSPECIFIED, ptScene); 115 | } 116 | } 117 | 118 | /*----------------------------------------------------------------------------* 119 | * Scene 4 * 120 | *----------------------------------------------------------------------------*/ 121 | 122 | static void __on_scene_gas_gauge_background_start(arm_2d_scene_t *ptScene) 123 | { 124 | user_scene_gas_gauge_t *ptThis = (user_scene_gas_gauge_t *)ptScene; 125 | ARM_2D_UNUSED(ptThis); 126 | 127 | } 128 | 129 | static void __on_scene_gas_gauge_background_complete(arm_2d_scene_t *ptScene) 130 | { 131 | user_scene_gas_gauge_t *ptThis = (user_scene_gas_gauge_t *)ptScene; 132 | ARM_2D_UNUSED(ptThis); 133 | 134 | } 135 | 136 | 137 | static void __on_scene_gas_gauge_frame_start(arm_2d_scene_t *ptScene) 138 | { 139 | user_scene_gas_gauge_t *ptThis = (user_scene_gas_gauge_t *)ptScene; 140 | ARM_2D_UNUSED(ptThis); 141 | int32_t nResult; 142 | do { 143 | 144 | arm_2d_helper_time_cos_slider(0, 255-16, 15000, 0, &nResult, &this.lTimestamp[2]); 145 | this.chBlurDegree = nResult; 146 | } while(0); 147 | 148 | do { 149 | /* simulate a full battery charging/discharge cycle */ 150 | arm_2d_helper_time_cos_slider(0, 1000, 30000, 0, &nResult, &this.lTimestamp[1]); 151 | 152 | if (this.hwGasgauge < nResult) { 153 | this.tStatus = BATTERY_STATUS_CHARGING; 154 | } else if (this.hwGasgauge > nResult) { 155 | this.tStatus = BATTERY_STATUS_DISCHARGING; 156 | } 157 | this.hwGasgauge = (uint16_t)nResult; 158 | } while(0); 159 | } 160 | 161 | static void __before_scene_gas_gauge_switching_out(arm_2d_scene_t *ptScene) 162 | { 163 | user_scene_gas_gauge_t *ptThis = (user_scene_gas_gauge_t *)ptScene; 164 | ARM_2D_UNUSED(ptThis); 165 | } 166 | 167 | static void __on_scene_gas_gauge_frame_complete(arm_2d_scene_t *ptScene) 168 | { 169 | user_scene_gas_gauge_t *ptThis = (user_scene_gas_gauge_t *)ptScene; 170 | ARM_2D_UNUSED(ptThis); 171 | 172 | /* switch to next scene after 3s */ 173 | if (arm_2d_helper_is_time_out(29000, &this.lTimestamp[0])) { 174 | //arm_2d_scene_player_switch_to_next_scene(ptScene->ptPlayer); 175 | } 176 | } 177 | 178 | static 179 | IMPL_PFB_ON_DRAW(__pfb_draw_scene_gas_gauge_background_handler) 180 | { 181 | user_scene_gas_gauge_t *ptThis = (user_scene_gas_gauge_t *)pTarget; 182 | ARM_2D_UNUSED(ptTile); 183 | ARM_2D_UNUSED(bIsNewFrame); 184 | /*-----------------------draw back ground begin-----------------------*/ 185 | 186 | 187 | 188 | /*-----------------------draw back ground end -----------------------*/ 189 | arm_2d_op_wait_async(NULL); 190 | 191 | return arm_fsm_rt_cpl; 192 | } 193 | 194 | static 195 | IMPL_PFB_ON_DRAW(__pfb_draw_scene_gas_gauge_handler) 196 | { 197 | user_scene_gas_gauge_t *ptThis = (user_scene_gas_gauge_t *)pTarget; 198 | ARM_2D_UNUSED(ptTile); 199 | ARM_2D_UNUSED(bIsNewFrame); 200 | 201 | 202 | /*-----------------------draw the foreground begin-----------------------*/ 203 | 204 | /* following code is just a demo, you can remove them */ 205 | 206 | arm_2d_canvas(ptTile, __canvas) { 207 | 208 | arm_2d_align_centre( __canvas, 128, 130) { 209 | 210 | arm_2d_layout(__centre_region) { 211 | 212 | __item_line_horizontal(64, 130) { 213 | battery_gasgauge_nixie_tube_show( &this.tBatteryNixieTube, 214 | ptTile, 215 | &__item_region, 216 | this.hwGasgauge, 217 | this.tStatus, 218 | bIsNewFrame); 219 | 220 | arm_2d_op_wait_async(NULL); 221 | 222 | 223 | arm_2d_size_t tTextSize = arm_lcd_get_string_line_box("00", &ARM_2D_FONT_A4_DIGITS_ONLY); 224 | 225 | arm_2d_align_bottom_centre(__item_region, tTextSize) { 226 | 227 | arm_lcd_text_set_target_framebuffer((arm_2d_tile_t *)ptTile); 228 | arm_lcd_text_set_font((arm_2d_font_t *)&ARM_2D_FONT_A4_DIGITS_ONLY); 229 | arm_lcd_text_set_draw_region(&__bottom_centre_region); 230 | arm_lcd_text_set_colour(GLCD_COLOR_NIXIE_TUBE, GLCD_COLOR_BLACK); 231 | arm_lcd_text_location(0,0); 232 | arm_lcd_printf("%02d", this.hwGasgauge / 10); 233 | 234 | arm_2d_op_wait_async(NULL); 235 | } 236 | } 237 | 238 | __item_line_horizontal(64, 130) { 239 | battery_gasgauge_liquid_show( &this.tBatteryLiquid, 240 | ptTile, 241 | &__item_region, 242 | this.hwGasgauge, 243 | this.tStatus, 244 | bIsNewFrame); 245 | 246 | arm_2d_op_wait_async(NULL); 247 | 248 | arm_2d_size_t tTextSize = arm_lcd_get_string_line_box("00", &ARM_2D_FONT_A4_DIGITS_ONLY); 249 | 250 | arm_2d_align_bottom_centre(__item_region, tTextSize) { 251 | 252 | arm_lcd_text_set_target_framebuffer((arm_2d_tile_t *)ptTile); 253 | arm_lcd_text_set_font((arm_2d_font_t *)&ARM_2D_FONT_A4_DIGITS_ONLY); 254 | arm_lcd_text_set_draw_region(&__bottom_centre_region); 255 | arm_lcd_text_set_colour(GLCD_COLOR_WHITE, GLCD_COLOR_BLACK); 256 | arm_lcd_text_location(0,0); 257 | arm_lcd_text_set_opacity(128); 258 | arm_lcd_printf("%02d", this.hwGasgauge / 10); 259 | arm_lcd_text_set_opacity(255); 260 | 261 | arm_2d_op_wait_async(NULL); 262 | } 263 | } 264 | } 265 | } 266 | 267 | 268 | arm_2d_filter_iir_blur_api_params_t tParams = { 269 | .chBlurDegree = this.chBlurDegree, 270 | }; 271 | 272 | arm_2dp_filter_iir_blur(&this.tBlurOP, 273 | ptTile, 274 | &__canvas, 275 | &tParams); 276 | } 277 | 278 | /*-----------------------draw the foreground end -----------------------*/ 279 | arm_2d_op_wait_async(NULL); 280 | 281 | return arm_fsm_rt_cpl; 282 | } 283 | 284 | ARM_NONNULL(1) 285 | user_scene_gas_gauge_t *__arm_2d_scene_gas_gauge_init( arm_2d_scene_player_t *ptDispAdapter, 286 | user_scene_gas_gauge_t *ptThis) 287 | { 288 | bool bUserAllocated = false; 289 | assert(NULL != ptDispAdapter); 290 | 291 | /*! define dirty regions */ 292 | IMPL_ARM_2D_REGION_LIST(s_tDirtyRegions, static) 293 | 294 | /* a dirty region to be specified at runtime*/ 295 | ADD_LAST_REGION_TO_LIST(s_tDirtyRegions, 296 | .tSize = { 297 | 128, 130, 298 | }, 299 | ), 300 | 301 | END_IMPL_ARM_2D_REGION_LIST(s_tDirtyRegions) 302 | 303 | s_tDirtyRegions[dimof(s_tDirtyRegions)-1].ptNext = NULL; 304 | 305 | /* get the screen region */ 306 | arm_2d_region_t tScreen 307 | = arm_2d_helper_pfb_get_display_area( 308 | &ptDispAdapter->use_as__arm_2d_helper_pfb_t); 309 | 310 | /* initialise dirty region 0 at runtime 311 | */ 312 | arm_2d_align_centre(tScreen, s_tDirtyRegions[0].tRegion.tSize) { 313 | s_tDirtyRegions[0].tRegion = __centre_region; 314 | } 315 | 316 | if (NULL == ptThis) { 317 | ptThis = (user_scene_gas_gauge_t *) 318 | __arm_2d_allocate_scratch_memory( sizeof(user_scene_gas_gauge_t), 319 | __alignof__(user_scene_gas_gauge_t), 320 | ARM_2D_MEM_TYPE_UNSPECIFIED); 321 | assert(NULL != ptThis); 322 | if (NULL == ptThis) { 323 | return NULL; 324 | } 325 | } else { 326 | bUserAllocated = true; 327 | memset(ptThis, 0, sizeof(user_scene_gas_gauge_t)); 328 | } 329 | 330 | *ptThis = (user_scene_gas_gauge_t){ 331 | .use_as__arm_2d_scene_t = { 332 | 333 | /* the canvas colour */ 334 | .tCanvas = {GLCD_COLOR_BLACK}, 335 | 336 | /* Please uncommon the callbacks if you need them 337 | */ 338 | //.fnBackground = &__pfb_draw_scene_gas_gauge_background_handler, 339 | .fnScene = &__pfb_draw_scene_gas_gauge_handler, 340 | //.ptDirtyRegion = (arm_2d_region_list_item_t *)s_tDirtyRegions, 341 | 342 | 343 | //.fnOnBGStart = &__on_scene_gas_gauge_background_start, 344 | //.fnOnBGComplete = &__on_scene_gas_gauge_background_complete, 345 | .fnOnFrameStart = &__on_scene_gas_gauge_frame_start, 346 | .fnBeforeSwitchOut = &__before_scene_gas_gauge_switching_out, 347 | .fnOnFrameCPL = &__on_scene_gas_gauge_frame_complete, 348 | .fnDepose = &__on_scene_gas_gauge_depose, 349 | }, 350 | .bUserAllocated = bUserAllocated, 351 | }; 352 | 353 | battery_gasgauge_nixie_tube_init(&this.tBatteryNixieTube); 354 | battery_gasgauge_liquid_init(&this.tBatteryLiquid); 355 | 356 | ARM_2D_OP_INIT(this.tBlurOP); 357 | 358 | arm_2d_scene_player_append_scenes( ptDispAdapter, 359 | &this.use_as__arm_2d_scene_t, 360 | 1); 361 | 362 | return ptThis; 363 | } 364 | 365 | 366 | 367 | 368 | #if defined(__clang__) 369 | # pragma clang diagnostic pop 370 | #endif 371 | 372 | #endif 373 | 374 | -------------------------------------------------------------------------------- /project/mdk/RTE/Acceleration/arm_2d_scene_gas_gauge.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009-2022 Arm Limited. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #ifndef __ARM_2D_SCENE_GAS_GAUGE_H__ 20 | #define __ARM_2D_SCENE_GAS_GAUGE_H__ 21 | 22 | /*============================ INCLUDES ======================================*/ 23 | 24 | #include "arm_2d.h" 25 | 26 | #if defined(RTE_Acceleration_Arm_2D_Helper_PFB) 27 | 28 | #include "arm_2d_helper_scene.h" 29 | 30 | #include "battery_gasgauge.h" 31 | 32 | #ifdef __cplusplus 33 | extern "C" { 34 | #endif 35 | 36 | #if defined(__clang__) 37 | # pragma clang diagnostic push 38 | # pragma clang diagnostic ignored "-Wunknown-warning-option" 39 | # pragma clang diagnostic ignored "-Wreserved-identifier" 40 | # pragma clang diagnostic ignored "-Wmissing-declarations" 41 | # pragma clang diagnostic ignored "-Wpadded" 42 | #elif __IS_COMPILER_ARM_COMPILER_5__ 43 | #elif __IS_COMPILER_GCC__ 44 | # pragma GCC diagnostic push 45 | # pragma GCC diagnostic ignored "-Wformat=" 46 | # pragma GCC diagnostic ignored "-Wpedantic" 47 | # pragma GCC diagnostic ignored "-Wpadded" 48 | #endif 49 | 50 | /*============================ MACROS ========================================*/ 51 | 52 | /* OOC header, please DO NOT modify */ 53 | #ifdef __USER_SCENE_GAS_GAUGE_IMPLEMENT__ 54 | # undef __USER_SCENE_GAS_GAUGE_IMPLEMENT__ 55 | # define __ARM_2D_IMPL__ 56 | #endif 57 | #include "arm_2d_utils.h" 58 | 59 | /*============================ MACROFIED FUNCTIONS ===========================*/ 60 | 61 | /*! 62 | * \brief initalize scene4 and add it to a user specified scene player 63 | * \param[in] __DISP_ADAPTER_PTR the target display adatper (i.e. scene player) 64 | * \param[in] ... this is an optional parameter. When it is NULL, a new 65 | * user_scene_gas_gauge_t will be allocated from HEAP and freed on 66 | * the deposing event. When it is non-NULL, the life-cycle is managed 67 | * by user. 68 | * \return user_scene_gas_gauge_t* the user_scene_gas_gauge_t instance 69 | */ 70 | #define arm_2d_scene_gas_gauge_init(__DISP_ADAPTER_PTR, ...) \ 71 | __arm_2d_scene_gas_gauge_init((__DISP_ADAPTER_PTR), (NULL, ##__VA_ARGS__)) 72 | 73 | /*============================ TYPES =========================================*/ 74 | /*! 75 | * \brief a user class for scene 4 76 | */ 77 | typedef struct user_scene_gas_gauge_t user_scene_gas_gauge_t; 78 | 79 | struct user_scene_gas_gauge_t { 80 | implement(arm_2d_scene_t); //! derived from class: arm_2d_scene_t 81 | 82 | ARM_PRIVATE( 83 | /* place your private member here, following two are examples */ 84 | int64_t lTimestamp[3]; 85 | bool bUserAllocated; 86 | uint16_t hwGasgauge; 87 | battery_nixie_tube_t tBatteryNixieTube; 88 | battery_liquid_t tBatteryLiquid; 89 | battery_status_t tStatus; 90 | 91 | uint8_t chBlurDegree; 92 | arm_2d_filter_iir_blur_descriptor_t tBlurOP; 93 | ) 94 | /* place your public member here */ 95 | 96 | }; 97 | 98 | /*============================ GLOBAL VARIABLES ==============================*/ 99 | /*============================ PROTOTYPES ====================================*/ 100 | 101 | ARM_NONNULL(1) 102 | extern 103 | user_scene_gas_gauge_t *__arm_2d_scene_gas_gauge_init( arm_2d_scene_player_t *ptDispAdapter, 104 | user_scene_gas_gauge_t *ptScene); 105 | 106 | #if defined(__clang__) 107 | # pragma clang diagnostic pop 108 | #elif __IS_COMPILER_GCC__ 109 | # pragma GCC diagnostic pop 110 | #endif 111 | 112 | #ifdef __cplusplus 113 | } 114 | #endif 115 | 116 | #endif 117 | 118 | #endif 119 | -------------------------------------------------------------------------------- /project/mdk/RTE/Acceleration/ttf2c.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | # -*- coding: utf-8 -*- 3 | 4 | # ************************************************************************************************* 5 | # Arm 2D project 6 | # @file ttf2c.py 7 | # @brief TrueTypeFont to C-array converter 8 | # 9 | # ************************************************************************************************* 10 | # 11 | # * Copyright (C) 2024 ARM Limited or its affiliates. All rights reserved. 12 | # * 13 | # * SPDX-License-Identifier: Apache-2.0 14 | # * 15 | # * Licensed under the Apache License, Version 2.0 (the License); you may 16 | # * not use this file except in compliance with the License. 17 | # * You may obtain a copy of the License at 18 | # * 19 | # * www.apache.org/licenses/LICENSE-2.0 20 | # * 21 | # * Unless required by applicable law or agreed to in writing, software 22 | # * distributed under the License is distributed on an AS IS BASIS, WITHOUT 23 | # * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 24 | # * See the License for the specific language governing permissions and 25 | # * limitations under the License. 26 | # */ 27 | 28 | 29 | import os 30 | import sys 31 | import argparse 32 | import freetype 33 | import numpy as np 34 | import math 35 | import binascii 36 | 37 | c_head_string=""" 38 | 39 | #include "arm_2d_helper.h" 40 | 41 | #if defined(__clang__) 42 | # pragma clang diagnostic push 43 | # pragma clang diagnostic ignored "-Wunknown-warning-option" 44 | # pragma clang diagnostic ignored "-Wreserved-identifier" 45 | # pragma clang diagnostic ignored "-Wmissing-variable-declarations" 46 | # pragma clang diagnostic ignored "-Wcast-qual" 47 | # pragma clang diagnostic ignored "-Wmissing-declarations" 48 | # pragma clang diagnostic ignored "-Wgnu-variable-sized-type-not-at-end" 49 | # pragma clang diagnostic ignored "-Wimplicit-int-conversion" 50 | # pragma clang diagnostic ignored "-Wdeclaration-after-statement" 51 | # pragma clang diagnostic ignored "-Wgnu-zero-variadic-macro-arguments" 52 | # pragma clang diagnostic ignored "-Wincompatible-pointer-types-discards-qualifiers" 53 | # pragma clang diagnostic ignored "-Wpadded" 54 | # pragma clang diagnostic ignored "-Wunused-parameter" 55 | # pragma clang diagnostic ignored "-Wunused-variable" 56 | # pragma clang diagnostic ignored "-Wsign-conversion" 57 | #elif defined(__IS_COMPILER_GCC__) 58 | # pragma GCC diagnostic ignored "-Wdiscarded-qualifiers" 59 | # pragma GCC diagnostic ignored "-Wunused-variable" 60 | #elif defined(__IS_COMPILER_ARM_COMPILER_5__) 61 | # pragma diag_suppress=1296,1,64 62 | #endif 63 | 64 | typedef struct { 65 | uint16_t hwIndex; 66 | arm_2d_size_t tCharSize; 67 | int16_t iAdvance; 68 | int16_t iBearingX; 69 | int16_t iBearingY; 70 | uint8_t chCodeLength; 71 | uint8_t chUTF8[4]; 72 | } const __ttf_char_descriptor_t; 73 | """ 74 | 75 | 76 | c_body_string=""" 77 | 78 | 79 | ARM_SECTION(\"arm2d.tile.c_tileUTF8{0}A{5}Mask\") 80 | static const arm_2d_tile_t c_tileUTF8{0}A{5}Mask = {{ 81 | .tRegion = {{ 82 | .tSize = {{ 83 | .iWidth = {1}, 84 | .iHeight = {4}, 85 | }}, 86 | }}, 87 | .tInfo = {{ 88 | .bIsRoot = true, 89 | .bHasEnforcedColour = true, 90 | .tColourInfo = {{ 91 | .chScheme = ARM_2D_COLOUR_{5}BIT, 92 | }}, 93 | }}, 94 | .pchBuffer = (uint8_t *)c_bmpUTF8{0}A{5}Font, 95 | }}; 96 | 97 | #define __UTF8_FONT_SIZE_{5}__ 98 | 99 | 100 | 101 | static 102 | IMPL_FONT_GET_CHAR_DESCRIPTOR(__utf8_a{5}_font_get_char_descriptor) 103 | {{ 104 | assert(NULL != ptFont); 105 | assert(NULL != ptDescriptor); 106 | assert(NULL != pchCharCode); 107 | 108 | arm_2d_user_font_t *ptThis = (arm_2d_user_font_t *)ptFont; 109 | ARM_2D_UNUSED(ptThis); 110 | 111 | memset(ptDescriptor, 0, sizeof(arm_2d_char_descriptor_t)); 112 | 113 | ptDescriptor->tileChar.ptParent = (arm_2d_tile_t *)&ptFont->tileFont; 114 | ptDescriptor->tileChar.tInfo.bDerivedResource = true; 115 | 116 | /* use the white space as the default char */ 117 | __ttf_char_descriptor_t *ptUTF8Char = 118 | (__ttf_char_descriptor_t *)&c_tUTF8{0}LookUpTableA{5}[dimof(c_tUTF8{0}LookUpTableA{5})-1]; 119 | 120 | arm_foreach(__ttf_char_descriptor_t, c_tUTF8{0}LookUpTableA{5}, ptChar) {{ 121 | if (0 == strncmp( (char *)pchCharCode, 122 | (char *)ptChar->chUTF8, 123 | ptChar->chCodeLength)) {{ 124 | /* found the UTF8 char */ 125 | ptUTF8Char = ptChar; 126 | break; 127 | }} 128 | }} 129 | 130 | ptDescriptor->chCodeLength = ptUTF8Char->chCodeLength; 131 | ptDescriptor->tileChar.tRegion.tSize = ptUTF8Char->tCharSize; 132 | ptDescriptor->tileChar.tRegion.tLocation.iY = (int16_t)ptUTF8Char->hwIndex; 133 | 134 | ptDescriptor->iAdvance = ptUTF8Char->iAdvance; 135 | ptDescriptor->iBearingX= ptUTF8Char->iBearingX; 136 | ptDescriptor->iBearingY= ptUTF8Char->iBearingY; 137 | 138 | return ptDescriptor; 139 | }} 140 | 141 | const 142 | struct {{ 143 | implement(arm_2d_user_font_t); 144 | arm_2d_char_idx_t tUTF8Table; 145 | }} ARM_2D_FONT_{0}_A{5} = {{ 146 | 147 | .use_as__arm_2d_user_font_t = {{ 148 | .use_as__arm_2d_font_t = {{ 149 | .tileFont = impl_child_tile( 150 | c_tileUTF8{0}A{5}Mask, 151 | 0, /* x offset */ 152 | 0, /* y offset */ 153 | {1}, /* width */ 154 | {4} /* height */ 155 | ), 156 | .tCharSize = {{ 157 | .iWidth = {1}, 158 | .iHeight = {2}, 159 | }}, 160 | .nCount = {3}, //!< Character count 161 | .fnGetCharDescriptor = &__utf8_a{5}_font_get_char_descriptor, 162 | .fnDrawChar = &__arm_2d_lcd_text_default_a{5}_font_draw_char, 163 | }}, 164 | .hwCount = 1, 165 | .hwDefaultCharIndex = 1, /* tBlank */ 166 | }}, 167 | 168 | .tUTF8Table = {{ 169 | .hwCount = {3}, 170 | .hwOffset = 0, 171 | }}, 172 | }}; 173 | 174 | #undef __UTF8_FONT_SIZE_{5}__ 175 | """ 176 | 177 | 178 | c_tail_string=""" 179 | 180 | #if defined(__clang__) 181 | # pragma clang diagnostic pop 182 | #elif defined(__IS_COMPILER_ARM_COMPILER_5__) 183 | # pragma diag_warning=1296 184 | #endif 185 | """ 186 | 187 | def generate_glyphs_data(input_file, text, pixel_size, font_bit_size, font_index): 188 | face = freetype.Face(input_file, index=font_index) 189 | face.set_pixel_sizes(0, pixel_size) 190 | 191 | glyphs_data = [] 192 | current_index = 0 193 | 194 | width_max = 0 195 | height_max = 0 196 | 197 | for char in set(text): 198 | # Get the glyph bitmap 199 | face.load_char(char) 200 | bitmap = face.glyph.bitmap 201 | utf8_encoding = char.encode('utf-8') 202 | 203 | if len(bitmap.buffer) == 0: 204 | continue 205 | if list(utf8_encoding) == [0xef, 0xbb, 0xbf]: 206 | continue 207 | 208 | width_max = max(bitmap.width, width_max) 209 | height_max = max(bitmap.rows, height_max) 210 | 211 | 212 | for char in sorted(set(text)): 213 | face.load_char(char) 214 | bitmap = face.glyph.bitmap 215 | utf8_encoding = char.encode('utf-8') 216 | 217 | if len(bitmap.buffer) == 0: 218 | continue 219 | if list(utf8_encoding) == [0xef, 0xbb, 0xbf]: 220 | continue 221 | 222 | advance_width = math.ceil(face.glyph.advance.x / 64.0) 223 | bearing_x = face.glyph.bitmap_left 224 | bearing_y = face.glyph.bitmap_top 225 | width = bitmap.width 226 | height = bitmap.rows 227 | pitch = bitmap.pitch 228 | 229 | if bitmap.pixel_mode == freetype.FT_PIXEL_MODE_MONO: 230 | buffer = np.frombuffer(bytes(bitmap.buffer), dtype=np.uint8) 231 | bits_per_row = pitch * 8 232 | bitmap_array = np.unpackbits(buffer).reshape((height, bits_per_row))[:, :width] 233 | bitmap_array = bitmap_array.astype(np.uint8) * 255 234 | 235 | elif bitmap.pixel_mode == freetype.FT_PIXEL_MODE_GRAY2: 236 | buffer = np.frombuffer(bytes(bitmap.buffer), dtype=np.uint8) 237 | bits_per_row = pitch * 4 238 | bitmap_array = np.unpackbits(buffer).reshape((height, bits_per_row))[:, :width * 2] 239 | bitmap_array = (bitmap_array.reshape((height, width * 2)) * 85).astype(np.uint8) 240 | 241 | elif bitmap.pixel_mode == freetype.FT_PIXEL_MODE_GRAY4: 242 | buffer = np.frombuffer(bytes(bitmap.buffer), dtype=np.uint8) 243 | bits_per_row = pitch * 2 244 | bitmap_array = np.unpackbits(buffer).reshape((height, bits_per_row))[:, :width * 4] 245 | bitmap_array = (bitmap_array.reshape((height, width * 2)) * 17).astype(np.uint8) 246 | 247 | elif bitmap.pixel_mode == freetype.FT_PIXEL_MODE_GRAY: 248 | bitmap_array = np.array(bitmap.buffer, dtype=np.uint8).reshape((height, width)) 249 | 250 | else: 251 | raise ValueError(f"Unsupported pixel mode: {bitmap.pixel_mode}") 252 | continue 253 | 254 | if width < width_max: 255 | padding = ((0, 0), (0, width_max - width)) 256 | bitmap_array = np.pad(bitmap_array, padding, 'constant') 257 | 258 | char_index_advance = len(bitmap_array.flatten()); 259 | 260 | if font_bit_size == 4: 261 | def RevBitQuadPerByte(byteArr): 262 | return ((byteArr & 0x0f) << 4) | ((byteArr & 0xf0) >> 4) 263 | 264 | # temporary array with 2x reduced width & pad 265 | (r, c) = np.shape(bitmap_array) 266 | tmp = np.empty((0, int((c+1)/2)), dtype=np.uint8) 267 | 268 | for cur in bitmap_array: 269 | bitsArr = np.unpackbits(cur.astype(np.uint8)) 270 | # generate indexes for MSB bit quadruplet every byte 271 | idx = np.arange(0, np.size(bitsArr), 8) 272 | idx = np.reshape(np.column_stack( 273 | (np.column_stack((idx+0, idx+1)), np.column_stack((idx+2, idx+3)))), 274 | (1,-1)), 275 | 276 | # extraction + endianness conversion appended in temp array 277 | # packbits is taking care of padding 278 | tmp = np.vstack([tmp, RevBitQuadPerByte(np.packbits(bitsArr[idx]))]) 279 | 280 | bitmap_array = tmp 281 | 282 | elif font_bit_size == 2: 283 | def RevBitPairPerByte(byteArr): 284 | return ((byteArr & 0x03) << 6) | ((byteArr & 0xc0) >> 6) | ((byteArr & 0x30) >> 2 ) | ((byteArr & 0x0c) << 2) 285 | 286 | # temporary array with 4x reduced width & pad 287 | (r, c) = np.shape(bitmap_array) 288 | tmp = np.empty((0, int((c+3)/4)), dtype=np.uint8) 289 | 290 | for cur in bitmap_array: 291 | bitsArr = np.unpackbits(cur.astype(np.uint8)) 292 | 293 | # generate indexes for MSB bit pair every byte 294 | idx = np.arange(0, np.size(bitsArr), 8) 295 | idx = np.reshape(np.column_stack((idx+0, idx+1)), (1,-1)) 296 | 297 | # extraction + endianness conversion appended in temp array 298 | tmp = np.vstack([tmp, RevBitPairPerByte(np.packbits(bitsArr[idx]))]) 299 | 300 | bitmap_array = tmp 301 | 302 | elif font_bit_size == 1: 303 | def RevBitPerByte(byteArr): 304 | return ((byteArr & 0x01) << 7) | ((byteArr & 0x80) >> 7) | \ 305 | ((byteArr & 0x02) << 5) | ((byteArr & 0x40) >> 5) | \ 306 | ((byteArr & 0x04) << 3) | ((byteArr & 0x20) >> 3) | \ 307 | ((byteArr & 0x08) << 1) | ((byteArr & 0x10) >> 1) 308 | 309 | # temporary array with 8x reduced width & pad 310 | (r, c) = np.shape(bitmap_array) 311 | tmp = np.empty((0, int((c+7)/8)), dtype=np.uint8) 312 | 313 | for cur in bitmap_array: 314 | bitsArr = np.unpackbits(cur.astype(np.uint8)) 315 | 316 | # generate indexes for MSB bit every byte 317 | idx = np.arange(0, np.size(bitsArr), 8) 318 | 319 | # extraction + endianness conversion 320 | tmp = np.vstack([tmp, RevBitPerByte(np.packbits(bitsArr[idx]))]) 321 | 322 | bitmap_array = tmp 323 | 324 | char_mask_array = bitmap_array.flatten() 325 | 326 | glyphs_data.append((char, char_mask_array, width, height, current_index, advance_width, bearing_x, bearing_y, utf8_encoding)) 327 | 328 | current_index += char_index_advance 329 | 330 | return glyphs_data, width_max, height_max 331 | 332 | 333 | def utf8_to_c_array(utf8_bytes): 334 | return '{' + ', '.join([f'0x{byte:02x}' for byte in utf8_bytes]) + '}' 335 | 336 | def write_c_code(glyphs_data, output_file, name, char_max_width, char_max_height, font_bit_size): 337 | 338 | with open(output_file, "a") as f: 339 | 340 | print("ARM_SECTION(\"arm2d.asset.FONT\")\nconst uint8_t c_bmpUTF8{0}A{1}Font[] = {{\n" 341 | .format(name, font_bit_size), 342 | file=f) 343 | 344 | for char, data, width, height, index, advance_width, bearing_x, bearing_y, utf8_encoding in glyphs_data: 345 | utf8_c_array = utf8_to_c_array(utf8_encoding) 346 | f.write(f"\n // Glyph for character {utf8_c_array}\n") 347 | hex_str = binascii.hexlify(data).decode() 348 | 349 | for i in range(0, len(hex_str), char_max_width*2): 350 | line = hex_str[i:i+char_max_width*2] 351 | spaced_line = ' '.join(f"0x{line[j:j+2]}," for j in range(0, len(line), 2)) 352 | f.write(" "); 353 | f.write(spaced_line) 354 | f.write("\n"); 355 | 356 | f.write(" // a white space\n "); 357 | f.write("0x00, " * (char_max_width * char_max_height)) 358 | f.write("\n};\n\n") 359 | 360 | print("ARM_SECTION(\"arm2d.asset.FONT\")\n __ttf_char_descriptor_t c_tUTF8{0}LookUpTableA{1}[] = {{\n" 361 | .format(name, font_bit_size), file=f) 362 | 363 | last_index = 0; 364 | last_advance = 0; 365 | last_height = 0; 366 | for char, data, width, height, index, advance_width, bearing_x, bearing_y, utf8_encoding in glyphs_data: 367 | utf8_c_array = utf8_to_c_array(utf8_encoding) 368 | last_index = index 369 | last_advance = advance_width 370 | last_height = height; 371 | f.write(f" {{ {round(index / char_max_width)}, {{ {width}, {height}, }}, {advance_width}, {bearing_x}, {bearing_y}, {len(utf8_encoding)}, {utf8_c_array} }},\n") 372 | 373 | last_index += char_max_width * last_height 374 | f.write(f" {{ {round(last_index / char_max_width)}, {{ {char_max_width}, {char_max_height}, }}, {char_max_width}, {0}, {char_max_height}, 1, {{0x20}} }},\n") 375 | 376 | f.write("};\n") 377 | 378 | print(c_body_string.format( name, 379 | char_max_width, 380 | char_max_height, 381 | len(glyphs_data), 382 | char_max_height*len(glyphs_data), 383 | font_bit_size), file=f) 384 | 385 | 386 | def main(): 387 | parser = argparse.ArgumentParser(description='TrueTypeFont to C array converter (v2.1.0)') 388 | parser.add_argument("-i", "--input", type=str, help="Path to the TTF file", required=True) 389 | parser.add_argument("--index", type=int, help="The Font Index in a TTC file", required=False, default=0) 390 | parser.add_argument("-t", "--text", type=str, help="Path to the text file", required=True) 391 | parser.add_argument("-n", "--name", type=str, help="The customized UTF8 font name", required=False, default="UTF8") 392 | parser.add_argument("-o", "--output", type=str, help="Path to the output C file", required=True) 393 | parser.add_argument("-p", "--pixelsize",type=int, help="Font size in pixels", required=False, default=32) 394 | parser.add_argument("-s", "--fontbitsize",type=int, help="font bit size (1,2,4,8)", required=False, default=0) 395 | 396 | if len(sys.argv)==1: 397 | parser.print_help(sys.stderr) 398 | sys.exit(1) 399 | 400 | args = parser.parse_args() 401 | 402 | if args.fontbitsize not in [1, 2, 4, 8, 0]: 403 | print(f'Invalid alpha size={args.fontbitsize}') 404 | sys.exit(1) 405 | 406 | 407 | with open(args.output, "w") as outputfile: 408 | print(c_head_string, file=outputfile) 409 | 410 | 411 | if args.fontbitsize in [1, 2, 4, 8]: 412 | with open(args.text, 'r', encoding='utf-8') as f: 413 | text = f.read() 414 | 415 | glyphs_data, char_max_width, char_max_height = generate_glyphs_data(args.input, text, args.pixelsize, args.fontbitsize, args.index) 416 | write_c_code(glyphs_data, args.output, args.name, char_max_width, char_max_height, args.fontbitsize) 417 | 418 | else: 419 | with open(args.text, 'r', encoding='utf-8') as f: 420 | text = f.read() 421 | 422 | glyphs_data, char_max_width, char_max_height = generate_glyphs_data(args.input, text, args.pixelsize, 1, args.index) 423 | write_c_code(glyphs_data, args.output, args.name, char_max_width, char_max_height, 1) 424 | 425 | 426 | with open(args.text, 'r', encoding='utf-8') as f: 427 | text = f.read() 428 | 429 | glyphs_data, char_max_width, char_max_height = generate_glyphs_data(args.input, text, args.pixelsize, 2, args.index) 430 | write_c_code(glyphs_data, args.output, args.name, char_max_width, char_max_height, 2) 431 | 432 | 433 | with open(args.text, 'r', encoding='utf-8') as f: 434 | text = f.read() 435 | 436 | glyphs_data, char_max_width, char_max_height = generate_glyphs_data(args.input, text, args.pixelsize, 4, args.index) 437 | write_c_code(glyphs_data, args.output, args.name, char_max_width, char_max_height, 4) 438 | 439 | 440 | with open(args.text, 'r', encoding='utf-8') as f: 441 | text = f.read() 442 | 443 | glyphs_data, char_max_width, char_max_height = generate_glyphs_data(args.input, text, args.pixelsize, 8, args.index) 444 | write_c_code(glyphs_data, args.output, args.name, char_max_width, char_max_height, 8) 445 | 446 | with open(args.output, "a") as outputfile: 447 | print(c_tail_string, file=outputfile) 448 | 449 | 450 | 451 | if __name__ == '__main__': 452 | main() 453 | -------------------------------------------------------------------------------- /project/mdk/RTE/CMSIS-View/EventRecorderConf.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016-2021 Arm Limited. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | * 18 | * Name: EventRecorderConf.h 19 | * Purpose: Event Recorder software component configuration options 20 | * Rev.: V1.1.0 21 | */ 22 | 23 | //-------- <<< Use Configuration Wizard in Context Menu >>> -------------------- 24 | 25 | // Event Recorder 26 | 27 | // Number of Records 28 | // <8=>8 <16=>16 <32=>32 <64=>64 <128=>128 <256=>256 <512=>512 <1024=>1024 29 | // <2048=>2048 <4096=>4096 <8192=>8192 <16384=>16384 <32768=>32768 30 | // <65536=>65536 31 | // Configures size of Event Record Buffer (each record is 16 bytes) 32 | // Must be 2^n (min=8, max=65536) 33 | #define EVENT_RECORD_COUNT 128ul 34 | 35 | // Time Stamp Source 36 | // <0=> DWT Cycle Counter <1=> SysTick <2=> CMSIS-RTOS2 System Timer 37 | // <3=> User Timer (Normal Reset) <4=> User Timer (Power-On Reset) 38 | // Selects source for 32-bit time stamp 39 | #define EVENT_TIMESTAMP_SOURCE 3 40 | 41 | // Time Stamp Clock Frequency [Hz] <0-1000000000> 42 | // Defines initial time stamp clock frequency (0 when not used) 43 | #define EVENT_TIMESTAMP_FREQ 0U 44 | 45 | // 46 | 47 | //------------- <<< end of configuration section >>> --------------------------- 48 | -------------------------------------------------------------------------------- /project/mdk/RTE/Compiler/EventRecorderConf.h: -------------------------------------------------------------------------------- 1 | /*------------------------------------------------------------------------------ 2 | * MDK - Component ::Event Recorder 3 | * Copyright (c) 2016-2018 ARM Germany GmbH. All rights reserved. 4 | *------------------------------------------------------------------------------ 5 | * Name: EventRecorderConf.h 6 | * Purpose: Event Recorder Configuration 7 | * Rev.: V1.1.0 8 | *----------------------------------------------------------------------------*/ 9 | 10 | //-------- <<< Use Configuration Wizard in Context Menu >>> -------------------- 11 | 12 | // Event Recorder 13 | 14 | // Number of Records 15 | // <8=>8 <16=>16 <32=>32 <64=>64 <128=>128 <256=>256 <512=>512 <1024=>1024 16 | // <2048=>2048 <4096=>4096 <8192=>8192 <16384=>16384 <32768=>32768 17 | // <65536=>65536 18 | // Configures size of Event Record Buffer (each record is 16 bytes) 19 | // Must be 2^n (min=8, max=65536) 20 | #define EVENT_RECORD_COUNT 64U 21 | 22 | // Time Stamp Source 23 | // <0=> DWT Cycle Counter <1=> SysTick <2=> CMSIS-RTOS2 System Timer 24 | // <3=> User Timer (Normal Reset) <4=> User Timer (Power-On Reset) 25 | // Selects source for 32-bit time stamp 26 | #define EVENT_TIMESTAMP_SOURCE 3 27 | 28 | // Time Stamp Clock Frequency [Hz] <0-1000000000> 29 | // Defines initial time stamp clock frequency (0 when not used) 30 | #define EVENT_TIMESTAMP_FREQ 0 31 | 32 | // 33 | 34 | //------------- <<< end of configuration section >>> --------------------------- 35 | -------------------------------------------------------------------------------- /project/mdk/RTE/Device/RP2040_Core0/env_wrapper.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | * Copyright 2021 Gorgon Meducer (Email:embedded_zhuoran@hotmail.com) * 3 | * * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); * 5 | * you may not use this file except in compliance with the License. * 6 | * You may obtain a copy of the License at * 7 | * * 8 | * http://www.apache.org/licenses/LICENSE-2.0 * 9 | * * 10 | * Unless required by applicable law or agreed to in writing, software * 11 | * distributed under the License is distributed on an "AS IS" BASIS, * 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * 13 | * See the License for the specific language governing permissions and * 14 | * limitations under the License. * 15 | * * 16 | ****************************************************************************/ 17 | /*============================ INCLUDES ======================================*/ 18 | #include "cmsis_compiler.h" 19 | 20 | 21 | /*============================ MACROS ========================================*/ 22 | /*============================ MACROFIED FUNCTIONS ===========================*/ 23 | /*============================ TYPES =========================================*/ 24 | /*============================ GLOBAL VARIABLES ==============================*/ 25 | /*============================ LOCAL VARIABLES ===============================*/ 26 | /*============================ PROTOTYPES ====================================*/ 27 | /*============================ IMPLEMENTATION ================================*/ 28 | 29 | #if defined(__clang__) 30 | # pragma clang diagnostic ignored "-Wunknown-warning-option" 31 | # pragma clang diagnostic ignored "-Wmacro-redefined" 32 | #endif 33 | 34 | #ifndef __ENV_WRAPPER_H__ 35 | # define __ENV_WRAPPER_H__ 1 36 | 37 | #include 38 | #include 39 | #include 40 | #include "cmsis_compiler.h" 41 | 42 | //! \name The macros to identify the compiler 43 | //! @{ 44 | 45 | //! \note for IAR 46 | #ifdef __IS_COMPILER_IAR__ 47 | # undef __IS_COMPILER_IAR__ 48 | #endif 49 | #if defined(__IAR_SYSTEMS_ICC__) 50 | # define __IS_COMPILER_IAR__ 1 51 | #endif 52 | 53 | //! \note for arm compiler 5 54 | #ifdef __IS_COMPILER_ARM_COMPILER_5__ 55 | # undef __IS_COMPILER_ARM_COMPILER_5__ 56 | #endif 57 | #if ((__ARMCC_VERSION >= 5000000) && (__ARMCC_VERSION < 6000000)) 58 | # define __IS_COMPILER_ARM_COMPILER_5__ 1 59 | #endif 60 | //! @} 61 | 62 | //! \note for arm compiler 6 63 | #ifdef __IS_COMPILER_ARM_COMPILER_6__ 64 | # undef __IS_COMPILER_ARM_COMPILER_6__ 65 | #endif 66 | #if defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050) 67 | # define __IS_COMPILER_ARM_COMPILER_6__ 1 68 | #endif 69 | 70 | #ifdef __IS_COMPILER_LLVM__ 71 | # undef __IS_COMPILER_LLVM__ 72 | #endif 73 | #if defined(__clang__) && !__IS_COMPILER_ARM_COMPILER_6__ 74 | # define __IS_COMPILER_LLVM__ 1 75 | #else 76 | //! \note for gcc 77 | # ifdef __IS_COMPILER_GCC__ 78 | # undef __IS_COMPILER_GCC__ 79 | # endif 80 | # if defined(__GNUC__) && !( defined(__IS_COMPILER_ARM_COMPILER_5__) \ 81 | || defined(__IS_COMPILER_ARM_COMPILER_6__) \ 82 | || defined(__IS_COMPILER_LLVM__)) 83 | # define __IS_COMPILER_GCC__ 1 84 | # endif 85 | //! @} 86 | #endif 87 | //! @} 88 | 89 | 90 | #if defined(__IS_COMPILER_ARM_COMPILER_6__) 91 | # pragma clang diagnostic ignored "-Wformat-extra-args" 92 | #endif 93 | 94 | #ifndef __ASM 95 | #define __ASM __asm 96 | #endif 97 | 98 | 99 | #if defined(__clang__) || defined(__IS_COMPILER_ARM_COMPILER_5__) 100 | # undef __force_inline 101 | # define __force_inline __attribute__((always_inline)) 102 | 103 | # undef __always_inline 104 | # define __always_inline __attribute__((always_inline)) 105 | 106 | # undef __unused 107 | # define __unused __attribute__((unused)) 108 | 109 | # undef __used 110 | # define __used __USED 111 | 112 | # undef __packed_aligned 113 | # define __packed_aligned __attribute__((packed, aligned(4))) 114 | 115 | # undef __printflike 116 | # define __printflike(...) __attribute__((format(printf, __VA_ARGS__))) 117 | 118 | # undef __noinline 119 | # define __noinline __attribute__((noinline)) 120 | 121 | #endif 122 | 123 | #undef __STRING 124 | # define __STRING(__S) #__S 125 | 126 | 127 | #undef offsetof 128 | #if defined(__clang__) || defined(__IS_COMPILER_GCC__) 129 | # define offsetof(st, m) __builtin_offsetof(st, m) 130 | #else 131 | # undef static_assert 132 | # define static_assert(...) 133 | # define offsetof(st, m) ((size_t)((char *)&((st *)0)->m - (char *)0)) 134 | #endif 135 | 136 | typedef unsigned int uint; 137 | 138 | #undef UNUSED_PARAM 139 | #define UNUSED_PARAM(__VAR) __VAR = __VAR 140 | 141 | #ifndef __CONCAT 142 | # define ____CONCAT(a,b) a##b 143 | # define __CONCAT(a,b) ____CONCAT(a,b) 144 | #endif 145 | 146 | ///** 147 | // \brief Get Control Register 148 | // \details Returns the content of the Control Register. 149 | // \return Control Register value 150 | // */ 151 | //static __force_inline uint32_t __get_current_exception(void) 152 | //{ 153 | // uint32_t result; 154 | 155 | // __ASM volatile ("MRS %0, ipsr" : "=r" (result) ); 156 | // return(result); 157 | //} 158 | 159 | #define __unhandled_user_irq Default_Handler 160 | 161 | #define __StackOneBottom Image$$ARM_LIB_STACK_ONE$$ZI$$Base 162 | 163 | #define __mutex_array_start Image$$ER_MUTEX_ARRAY$$ZI$$Base 164 | #define __mutex_array_end Image$$ER_MUTEX_ARRAY$$ZI$$Limit 165 | 166 | #define PROGRAM_STATUS_REG 167 | #define PICO_ON_DEVICE 1 168 | 169 | 170 | #undef __sev 171 | #undef __wfi 172 | #undef __wfe 173 | #undef __dmb 174 | //#undef __dsb 175 | //#undef __isb 176 | 177 | #define __sev __builtin_arm_sev 178 | #define __wfi __builtin_arm_wfi 179 | #define __wfe __builtin_arm_wfe 180 | 181 | #ifndef __PLOOC_VA_NUM_ARGS_IMPL 182 | # define __PLOOC_VA_NUM_ARGS_IMPL( _0,_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11, \ 183 | _12,_13,_14,_15,_16,__N,...) __N 184 | #endif 185 | 186 | #ifndef __PLOOC_VA_NUM_ARGS 187 | #define __PLOOC_VA_NUM_ARGS(...) \ 188 | __PLOOC_VA_NUM_ARGS_IMPL( 0,##__VA_ARGS__,16,15,14,13,12,11,10,9, \ 189 | 8,7,6,5,4,3,2,1,0) 190 | #endif 191 | 192 | #define __dmb0() __builtin_arm_dmb(0xF) 193 | #define __dmb1(__N) __builtin_arm_dmb(__N) 194 | 195 | #define __dmb(...) __CONCAT(__dmb, __PLOOC_VA_NUM_ARGS(__VA_ARGS__))(__VA_ARGS__) 196 | 197 | //#define __dsb __DSB 198 | //#define __isb __ISB 199 | 200 | typedef uint16_t __uint16_t; 201 | 202 | #include "pico/platform.h" 203 | 204 | #if 0 /* a configuration for over-clocking to 250MHz */ 205 | #define PLL_SYS_POSTDIV2 1 206 | #define PLL_SYS_POSTDIV1 6 207 | #define PLL_SYS_VCO_FREQ_KHZ (1500 * KHZ) 208 | #define SYS_CLK_KHZ (250 * KHZ) 209 | #endif 210 | 211 | #endif 212 | -------------------------------------------------------------------------------- /project/mdk/RTE/Device/RP2040_Core0/rp2040.sct: -------------------------------------------------------------------------------- 1 | #! armclang -E --target=arm-arm-none-eabi -mcpu=cortex-m0+ -xc 2 | ; command above MUST be in first line (no comment above!) 3 | 4 | /* 5 | ;-------- <<< Use Configuration Wizard in Context Menu >>> ------------------- 6 | */ 7 | 8 | /*--------------------- Flash Configuration ---------------------------------- 9 | ; Flash Configuration 10 | ; Flash Base Address <0x0-0xFFFFFFFF:8> 11 | ; Flash Size (in Bytes) <0x0-0xFFFFFFFF:8> 12 | ; 13 | *----------------------------------------------------------------------------*/ 14 | #define __ROM_BASE 0x10000000 15 | #define __ROM_SIZE 0x00200000 16 | 17 | /*--------------------- Embedded RAM Configuration --------------------------- 18 | ; RAM Configuration 19 | ; RAM Base Address <0x0-0xFFFFFFFF:8> 20 | ; RAM Size (in Bytes) <0x0-0xFFFFFFFF:8> 21 | ; 22 | *----------------------------------------------------------------------------*/ 23 | #define __RAM_BASE 0x20000000 24 | #define __RAM_SIZE 0x00042000 25 | 26 | /*--------------------- Stack / Heap Configuration --------------------------- 27 | ; Stack / Heap Configuration 28 | ; Stack Size (in Bytes) <0x0-0xFFFFFFFF:8> 29 | ; Heap Size (in Bytes) <0x0-0xFFFFFFFF:8> 30 | ; 31 | *----------------------------------------------------------------------------*/ 32 | #define __STACK_SIZE 0x00001000 33 | #define __HEAP_SIZE 0x00001000 34 | 35 | /* 36 | ;------------- <<< end of configuration section >>> --------------------------- 37 | */ 38 | 39 | 40 | /*---------------------------------------------------------------------------- 41 | User Stack & Heap boundary definition 42 | *----------------------------------------------------------------------------*/ 43 | #define __HEAP_BASE (AlignExpr(+0, 8)) /* starts after RW_RAM section, 8 byte aligned */ 44 | 45 | #define __STACK_ONE_SIZE 512 46 | 47 | /*---------------------------------------------------------------------------- 48 | Scatter File Definitions definition 49 | *----------------------------------------------------------------------------*/ 50 | #define __RO_BASE __ROM_BASE 51 | #define __RO_SIZE __ROM_SIZE 52 | 53 | #define __RW_SIZE (__RAM_SIZE - __STACK_SIZE - __HEAP_SIZE) 54 | 55 | /* 56 | * Stage two Boot 57 | */ 58 | LR_STAGE2_BOOT __RO_BASE 0x100 { 59 | ER_STAGE2_BOOT +0 0x100 { 60 | compile_time_choice.o (+RO) 61 | } 62 | ER_FILL ImageLimit(ER_STAGE2_BOOT) FILL 0xDEADBEEF 0x100 - ImageLength(ER_STAGE2_BOOT) { 63 | } 64 | } 65 | 66 | /* 67 | * next to stage two boot 68 | */ 69 | LR_ROM +0 __RO_SIZE - 0x100 { ; load region size_region 70 | ER_ROM +0 __RO_SIZE { ; load address = execution address 71 | *.o (RESET, +First) 72 | *(InRoot$$Sections) 73 | * (+RO-DATA) 74 | * (.flashdata.*) 75 | 76 | * (:gdef:Reset_Handler) 77 | * (:gdef:SystemInit) 78 | .ANY (+RO-CODE) 79 | .ANY (+XO) 80 | } 81 | 82 | /* 83 | * This is required by pico-sdk 84 | */ 85 | ER_RAM_VECTOR_TABLE __RAM_BASE { 86 | * (.ram_vector_table) 87 | } 88 | 89 | /* 90 | * This is required by pico-sdk 91 | */ 92 | ARM_LIB_STACK_ONE +0 ALIGN 8 EMPTY __STACK_ONE_SIZE { 93 | } 94 | 95 | ARM_LIB_STACK +0 ALIGN 8 EMPTY __STACK_SIZE { ; Reserve empty region for stack 96 | } 97 | 98 | /* 99 | * This is required by pico-sdk 100 | */ 101 | ER_MUTEX_ARRAY +0 { 102 | * (.mutex_array.*) 103 | * (.mutex_array) 104 | } 105 | 106 | RW_RAM +0 { ; RW data 107 | .ANY (.time_critical.*) 108 | .ANY (+RW +ZI) 109 | } 110 | 111 | RW_IRAM_NOINIT +0 UNINIT { ; RW data 112 | .ANY (.after_data.*) 113 | .ANY (.bss.noinit) 114 | .ANY (.uninitialized_data.*) 115 | } 116 | 117 | #if __HEAP_SIZE > 0 118 | ARM_LIB_HEAP __HEAP_BASE EMPTY __HEAP_SIZE { ; Reserve empty region for heap 119 | } 120 | #endif 121 | 122 | 123 | 124 | /* This empty, zero long execution region is here to mark the limit address 125 | * of the last execution region that is allocated in SRAM. 126 | */ 127 | SRAM_WATERMARK +0 EMPTY 0x0 { 128 | } 129 | /* Make sure that the sections allocated in the SRAM does not exceed the 130 | * size of the SRAM available. 131 | */ 132 | ScatterAssert(ImageLimit(SRAM_WATERMARK) <= __RAM_BASE + __RAM_SIZE) 133 | 134 | } 135 | -------------------------------------------------------------------------------- /project/mdk/RTE/Device/RP2040_Core0/rp2040_no_flash.sct: -------------------------------------------------------------------------------- 1 | #! armclang -E --target=arm-arm-none-eabi -mcpu=cortex-m0 -xc 2 | ; command above MUST be in first line (no comment above!) 3 | ; ************************************************************* 4 | ; *** Scatter-Loading Description File generated by uVision *** 5 | ; ************************************************************* 6 | 7 | #define FLASH_SIZE 0x00200000 8 | #define SRAM_SIZE (1024*248) 9 | 10 | #define STACK_0_SIZE (1024*4) 11 | #define STACK_1_SIZE (256) 12 | 13 | #define HEAP_0_SIZE (1024*32) 14 | #define HEAP_1_SIZE (256) 15 | 16 | #define RAMSIZE_VALID (SRAM_SIZE - \ 17 | STACK_1_SIZE - HEAP_1_SIZE - \ 18 | STACK_0_SIZE - HEAP_0_SIZE - 0x100) 19 | 20 | ;LR_STAGE2_BOOT 0x10000000 0x100 { 21 | ; ER_STAGE2_BOOT +0 0x100 { 22 | ; compile_time_choice.o (+RO) 23 | ; } 24 | ; ER_FILL ImageLimit(ER_STAGE2_BOOT) FILL 0xDEADBEEF 0x100 - ImageLength(ER_STAGE2_BOOT) { 25 | ; } 26 | ;} 27 | 28 | LR_IROM1 0x20000000 SRAM_SIZE { ; load region size_region 29 | 30 | ER_BINRAY_INFO +0 { 31 | * (:gdef:Reset_Handler) //!< please always make sure that Reset_Handler is placed here. 32 | * (.binary_info_header) 33 | } 34 | 35 | ER_RAM_VECTOR_TABLE +0 ALIGN 256 { 36 | * (.ram_vector_table) 37 | } 38 | 39 | 40 | ER_FLASH +0 { ; load address = execution address 41 | *.o (RESET, +First) 42 | *(InRoot$$Sections) 43 | * (+RO-DATA) 44 | startup_RP2040.o (+RO) 45 | } 46 | 47 | ER_MUTEX_ARRAY +0 { 48 | * (.mutex_array.*) 49 | * (.mutex_array) 50 | } 51 | 52 | RW_IRAM_CODE +0 { 53 | * (+RO-CODE) 54 | * (+XO) 55 | } 56 | 57 | ARM_LIB_STACK +0 ALIGN 8 EMPTY STACK_0_SIZE { 58 | } 59 | 60 | ARM_LIB_STACK_ONE +0 ALIGN 8 EMPTY STACK_1_SIZE { 61 | } 62 | ARM_LIB_HEAP +0 ALIGN 8 EMPTY HEAP_0_SIZE { 63 | } 64 | ARM_LIB_HEAP_ONE +0 ALIGN 8 EMPTY HEAP_1_SIZE { 65 | } 66 | 67 | 68 | 69 | ;ER_PREINIT_ARRAY +0 { 70 | ; * (.preinit_array.*) 71 | ; * (.preinit_array) 72 | ;} 73 | 74 | RW_IRAM +0 { ; RW data 75 | .ANY (+RW +ZI) 76 | } 77 | 78 | RW_IRAM_UNINIT +0 UNINIT { 79 | .ANY (.bss.noinit) 80 | } 81 | 82 | 83 | 84 | } 85 | 86 | -------------------------------------------------------------------------------- /project/mdk/RTE/Device/RP2040_Core0/startup_rp2040.c: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * @file startup_rp2040.c 3 | * @brief CMSIS-Core(M) Device Startup File for 4 | * Raspberry Pi RP2040 5 | * @version V1.1.0 6 | * @date 21. Nov 2022 7 | ******************************************************************************/ 8 | /* 9 | * Copyright (c) 2021 Arm Limited. All rights reserved. 10 | * 11 | * SPDX-License-Identifier: Apache-2.0 12 | * 13 | * Licensed under the Apache License, Version 2.0 (the License); you may 14 | * not use this file except in compliance with the License. 15 | * You may obtain a copy of the License at 16 | * 17 | * www.apache.org/licenses/LICENSE-2.0 18 | * 19 | * Unless required by applicable law or agreed to in writing, software 20 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 21 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | * See the License for the specific language governing permissions and 23 | * limitations under the License. 24 | */ 25 | 26 | #include "rp2040.h" 27 | 28 | /*---------------------------------------------------------------------------- 29 | External References 30 | *----------------------------------------------------------------------------*/ 31 | extern uint32_t __INITIAL_SP; 32 | 33 | extern __NO_RETURN void __PROGRAM_START(void); 34 | 35 | /*---------------------------------------------------------------------------- 36 | Internal References 37 | *----------------------------------------------------------------------------*/ 38 | __NO_RETURN void Reset_Handler (void); 39 | void Default_Handler(void); 40 | 41 | /*---------------------------------------------------------------------------- 42 | Exception / Interrupt Handler 43 | *----------------------------------------------------------------------------*/ 44 | /* Exceptions */ 45 | void NMI_Handler (void) __attribute__ ((weak, alias("Default_Handler"))); 46 | void HardFault_Handler (void) __attribute__ ((weak)); 47 | void SVC_Handler (void) __attribute__ ((weak, alias("Default_Handler"))); 48 | void PendSV_Handler (void) __attribute__ ((weak, alias("Default_Handler"))); 49 | void SysTick_Handler (void) __attribute__ ((weak, alias("Default_Handler"))); 50 | 51 | void TIMER_IRQ_0_Handler (void) __attribute__ ((weak, alias("Default_Handler"))); 52 | void TIMER_IRQ_1_Handler (void) __attribute__ ((weak, alias("Default_Handler"))); 53 | void TIMER_IRQ_2_Handler (void) __attribute__ ((weak, alias("Default_Handler"))); 54 | void TIMER_IRQ_3_Handler (void) __attribute__ ((weak, alias("Default_Handler"))); 55 | void PWM_IRQ_WRAP_Handler (void) __attribute__ ((weak, alias("Default_Handler"))); 56 | void USBCTRL_IRQ_Handler (void) __attribute__ ((weak, alias("Default_Handler"))); 57 | void XIP_IRQ_Handler (void) __attribute__ ((weak, alias("Default_Handler"))); 58 | void PIO0_IRQ_0_Handler (void) __attribute__ ((weak, alias("Default_Handler"))); 59 | void PIO0_IRQ_1_Handler (void) __attribute__ ((weak, alias("Default_Handler"))); 60 | void PIO1_IRQ_0_Handler (void) __attribute__ ((weak, alias("Default_Handler"))); 61 | void PIO1_IRQ_1_Handler (void) __attribute__ ((weak, alias("Default_Handler"))); 62 | void DMA_IRQ_0_Handler (void) __attribute__ ((weak, alias("Default_Handler"))); 63 | void DMA_IRQ_1_Handler (void) __attribute__ ((weak, alias("Default_Handler"))); 64 | void IO_IRQ_BANK0_Handler (void) __attribute__ ((weak, alias("Default_Handler"))); 65 | void IO_IRQ_QSPI_Handler (void) __attribute__ ((weak, alias("Default_Handler"))); 66 | void SIO_IRQ_PROC0_Handler (void) __attribute__ ((weak, alias("Default_Handler"))); 67 | void SIO_IRQ_PROC1_Handler (void) __attribute__ ((weak, alias("Default_Handler"))); 68 | void CLOCKS_IRQ_Handler (void) __attribute__ ((weak, alias("Default_Handler"))); 69 | void SPI0_IRQ_Handler (void) __attribute__ ((weak, alias("Default_Handler"))); 70 | void SPI1_IRQ_Handler (void) __attribute__ ((weak, alias("Default_Handler"))); 71 | void UART0_IRQ_Handler (void) __attribute__ ((weak, alias("Default_Handler"))); 72 | void UART1_IRQ_Handler (void) __attribute__ ((weak, alias("Default_Handler"))); 73 | void ADC_IRQ_FIFO_Handler (void) __attribute__ ((weak, alias("Default_Handler"))); 74 | void I2C0_IRQ_Handler (void) __attribute__ ((weak, alias("Default_Handler"))); 75 | void I2C1_IRQ_Handler (void) __attribute__ ((weak, alias("Default_Handler"))); 76 | void RTC_IRQ_Handler (void) __attribute__ ((weak, alias("Default_Handler"))); 77 | 78 | 79 | /*---------------------------------------------------------------------------- 80 | Exception / Interrupt Vector table 81 | *----------------------------------------------------------------------------*/ 82 | 83 | #if defined ( __GNUC__ ) 84 | #pragma GCC diagnostic push 85 | #pragma GCC diagnostic ignored "-Wpedantic" 86 | #endif 87 | 88 | extern const VECTOR_TABLE_Type __VECTOR_TABLE[48]; 89 | const VECTOR_TABLE_Type __VECTOR_TABLE[48] __VECTOR_TABLE_ATTRIBUTE = { 90 | (VECTOR_TABLE_Type)(&__INITIAL_SP), /* Initial Stack Pointer */ 91 | Reset_Handler, /* Reset Handler */ 92 | NMI_Handler, /* -14 NMI Handler */ 93 | HardFault_Handler, /* -13 Hard Fault Handler */ 94 | 0, /* Reserved */ 95 | 0, /* Reserved */ 96 | 0, /* Reserved */ 97 | 0, /* Reserved */ 98 | 0, /* Reserved */ 99 | 0, /* Reserved */ 100 | 0, /* Reserved */ 101 | SVC_Handler, /* -5 SVCall Handler */ 102 | 0, /* Reserved */ 103 | 0, /* Reserved */ 104 | PendSV_Handler, /* -2 PendSV Handler */ 105 | SysTick_Handler, /* -1 SysTick Handler */ 106 | 107 | /* Interrupts */ 108 | TIMER_IRQ_0_Handler, /* 0 TIMER_IRQ_0 */ 109 | TIMER_IRQ_1_Handler, /* 1 TIMER_IRQ_1 */ 110 | TIMER_IRQ_2_Handler, /* 2 TIMER_IRQ_2 */ 111 | TIMER_IRQ_3_Handler, /* 3 TIMER_IRQ_3 */ 112 | PWM_IRQ_WRAP_Handler, /* 4 PWM_IRQ_WRAP */ 113 | USBCTRL_IRQ_Handler, /* 5 USBCTRL_IRQ */ 114 | XIP_IRQ_Handler, /* 6 XIP_IRQ */ 115 | PIO0_IRQ_0_Handler, /* 7 PIO0_IRQ_0 */ 116 | PIO0_IRQ_1_Handler, /* 8 PIO0_IRQ_1 */ 117 | PIO1_IRQ_0_Handler, /* 9 PIO1_IRQ_0 */ 118 | PIO1_IRQ_1_Handler, /* 10 PIO1_IRQ_1 */ 119 | DMA_IRQ_0_Handler, /* 11 DMA_IRQ_0 */ 120 | DMA_IRQ_1_Handler, /* 12 DMA_IRQ_1 */ 121 | IO_IRQ_BANK0_Handler, /* 13 IO_IRQ_BANK0 */ 122 | IO_IRQ_QSPI_Handler, /* 14 IO_IRQ_QSPI */ 123 | SIO_IRQ_PROC0_Handler, /* 15 SIO_IRQ_PROC0 */ 124 | SIO_IRQ_PROC1_Handler, /* 16 SIO_IRQ_PROC1 */ 125 | CLOCKS_IRQ_Handler, /* 17 CLOCKS_IRQ */ 126 | SPI0_IRQ_Handler, /* 18 SPI0_IRQ */ 127 | SPI1_IRQ_Handler, /* 19 SPI1_IRQ */ 128 | UART0_IRQ_Handler, /* 20 UART0_IRQ */ 129 | UART1_IRQ_Handler, /* 21 UART1_IRQ */ 130 | ADC_IRQ_FIFO_Handler, /* 22 ADC_IRQ_FIFO */ 131 | I2C0_IRQ_Handler, /* 23 I2C0_IRQ */ 132 | I2C1_IRQ_Handler, /* 24 I2C1_IRQ */ 133 | RTC_IRQ_Handler /* 25 RTC_IRQ */ 134 | }; 135 | 136 | #if defined ( __GNUC__ ) 137 | #pragma GCC diagnostic pop 138 | #endif 139 | 140 | /*---------------------------------------------------------------------------- 141 | Reset Handler called on controller reset 142 | *----------------------------------------------------------------------------*/ 143 | __NO_RETURN __USED void Reset_Handler(void) 144 | { 145 | __set_MSP((uintptr_t)(&__INITIAL_SP)); 146 | 147 | SystemInit(); /* CMSIS System Initialization */ 148 | __PROGRAM_START(); /* Enter PreMain (C library entry point) */ 149 | } 150 | 151 | 152 | #if defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050) 153 | #pragma clang diagnostic push 154 | #pragma clang diagnostic ignored "-Wmissing-noreturn" 155 | #endif 156 | 157 | /*---------------------------------------------------------------------------- 158 | Hard Fault Handler 159 | *----------------------------------------------------------------------------*/ 160 | void HardFault_Handler(void) 161 | { 162 | while(1); 163 | } 164 | 165 | /*---------------------------------------------------------------------------- 166 | Default Handler for Exceptions / Interrupts 167 | *----------------------------------------------------------------------------*/ 168 | void Default_Handler(void) 169 | { 170 | while(1); 171 | } 172 | 173 | /* a non-intrusive way of keep the _stage2_boot */ 174 | extern 175 | void _stage2_boot(void); 176 | 177 | __attribute__((used)) 178 | void __keep_stage2_boot(void) 179 | { 180 | _stage2_boot(); 181 | while(1) __NOP(); 182 | } 183 | 184 | 185 | #if defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050) 186 | #pragma clang diagnostic pop 187 | #endif 188 | 189 | -------------------------------------------------------------------------------- /project/mdk/RTE/Device/RP2040_Core0/system_rp2040.c: -------------------------------------------------------------------------------- 1 | /*************************************************************************//** 2 | * @file system_RP2040.c 3 | * @brief CMSIS-Core(M) Device Peripheral Access Layer Header File for 4 | * Device RP2040 5 | * @version V1.1.0 6 | * @date 21. Nov 2023 7 | *****************************************************************************/ 8 | /* 9 | * Copyright (c) 2009-2021 Arm Limited. All rights reserved. 10 | * Copyright (c) 2020 Raspberry Pi (Trading) Ltd. 11 | * 12 | * SPDX-License-Identifier: Apache-2.0 13 | * 14 | * Licensed under the Apache License, Version 2.0 (the License); you may 15 | * not use this file except in compliance with the License. 16 | * You may obtain a copy of the License at 17 | * 18 | * www.apache.org/licenses/LICENSE-2.0 19 | * 20 | * Unless required by applicable law or agreed to in writing, software 21 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 22 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 23 | * See the License for the specific language governing permissions and 24 | * limitations under the License. 25 | * 26 | * SPDX-License-Identifier: BSD-3-Clause 27 | */ 28 | 29 | #include 30 | #include "rp2040.h" 31 | 32 | #define XTAL (12000000UL) /* Oscillator frequency */ 33 | 34 | #define SYSTEM_CLOCK (XTAL / 2U) 35 | 36 | /*--------------------------------------------------------------------------- 37 | System Core Clock Variable 38 | *---------------------------------------------------------------------------*/ 39 | uint32_t SystemCoreClock = SYSTEM_CLOCK; /* System Clock Frequency (Core Clock)*/ 40 | 41 | /*--------------------------------------------------------------------------- 42 | System Core Clock function 43 | *---------------------------------------------------------------------------*/ 44 | __WEAK 45 | void SystemCoreClockUpdate (void) 46 | { 47 | SystemCoreClock = SYSTEM_CLOCK; 48 | } 49 | 50 | /*--------------------------------------------------------------------------- 51 | System initialization function 52 | *---------------------------------------------------------------------------*/ 53 | extern const VECTOR_TABLE_Type __VECTOR_TABLE[48]; 54 | 55 | void SystemInit (void) 56 | { 57 | #if defined (__VTOR_PRESENT) && (__VTOR_PRESENT == 1U) 58 | SCB->VTOR = (uint32_t) &(__VECTOR_TABLE); 59 | #endif 60 | 61 | SystemCoreClock = SYSTEM_CLOCK; 62 | } 63 | -------------------------------------------------------------------------------- /project/mdk/RTE/Utilities/core_portme.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2018 Embedded Microprocessor Benchmark Consortium (EEMBC) 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | 16 | Original Author: Shay Gal-on 17 | */ 18 | 19 | /* Topic : Description 20 | This file contains configuration constants required to execute on 21 | different platforms 22 | */ 23 | #ifndef CORE_PORTME_H 24 | #define CORE_PORTME_H 25 | 26 | #include "perf_counter.h" 27 | 28 | #if defined(__clang__) 29 | # pragma clang diagnostic ignored "-Wunknown-warning-option" 30 | # pragma clang diagnostic ignored "-Wreserved-identifier" 31 | # pragma clang diagnostic ignored "-Wundef" 32 | # pragma clang diagnostic ignored "-Wmissing-variable-declarations" 33 | # pragma clang diagnostic ignored "-Wpadded" 34 | # pragma clang diagnostic ignored "-Wstrict-prototypes" 35 | # pragma clang diagnostic ignored "-Wswitch-enum" 36 | #endif 37 | 38 | 39 | /************************/ 40 | /* Data types and settings */ 41 | /************************/ 42 | /* Configuration : HAS_FLOAT 43 | Define to 1 if the platform supports floating point. 44 | */ 45 | #ifndef HAS_FLOAT 46 | #define HAS_FLOAT 1 47 | #endif 48 | /* Configuration : HAS_TIME_H 49 | Define to 1 if platform has the time.h header file, 50 | and implementation of functions thereof. 51 | */ 52 | #ifndef HAS_TIME_H 53 | #define HAS_TIME_H 1 54 | #endif 55 | /* Configuration : USE_CLOCK 56 | Define to 1 if platform has the time.h header file, 57 | and implementation of functions thereof. 58 | */ 59 | #ifndef USE_CLOCK 60 | #define USE_CLOCK 1 61 | #endif 62 | /* Configuration : HAS_STDIO 63 | Define to 1 if the platform has stdio.h. 64 | */ 65 | #ifndef HAS_STDIO 66 | #define HAS_STDIO 1 67 | #endif 68 | /* Configuration : HAS_PRINTF 69 | Define to 1 if the platform has stdio.h and implements the printf 70 | function. 71 | */ 72 | #ifndef HAS_PRINTF 73 | #define HAS_PRINTF 1 74 | #endif 75 | 76 | /* Configuration : CORE_TICKS 77 | Define type of return from the timing functions. 78 | */ 79 | typedef int64_t CORE_TICKS; 80 | 81 | /* Definitions : COMPILER_VERSION, COMPILER_FLAGS, MEM_LOCATION 82 | Initialize these strings per platform 83 | */ 84 | #ifndef COMPILER_VERSION 85 | 86 | #if __IS_COMPILER_ARM_COMPILER_6__ 87 | #define COMPILER_VERSION "Arm Compiler 6" 88 | #elif __IS_COMPILER_ARM_COMPILER_5__ 89 | #define COMPILER_VERSION "Arm Compiler 5" 90 | #elif __IS_COMPILER_LLVM__ 91 | #define COMPILER_VERSION __VERSION__ 92 | #elif __IS_COMPILER_IAR__ 93 | #define COMPILER_VERSION "IAR" 94 | #elif __IS_COMPILER_GCC__ 95 | #define COMPILER_VERSION "GCC"__VERSION__ 96 | #else 97 | #define COMPILER_VERSION "Please put compiler version here (e.g. gcc 4.1)" 98 | #endif 99 | 100 | 101 | #endif 102 | #ifndef COMPILER_FLAGS 103 | #define COMPILER_FLAGS \ 104 | "Unspecified" /* "Please put compiler flags here (e.g. -o3)" */ 105 | #endif 106 | 107 | 108 | /* Data Types : 109 | To avoid compiler issues, define the data types that need ot be used for 110 | 8b, 16b and 32b in . 111 | 112 | *Imprtant* : 113 | ee_ptr_int needs to be the data type used to hold pointers, otherwise 114 | coremark may fail!!! 115 | */ 116 | typedef signed short ee_s16; 117 | typedef unsigned short ee_u16; 118 | typedef signed int ee_s32; 119 | typedef double ee_f32; 120 | typedef unsigned char ee_u8; 121 | typedef unsigned int ee_u32; 122 | typedef ee_u32 ee_ptr_int; 123 | typedef size_t ee_size_t; 124 | /* align_mem : 125 | This macro is used to align an offset to point to a 32b value. It is 126 | used in the Matrix algorithm to initialize the input memory blocks. 127 | */ 128 | #define align_mem(x) (void *)(4 + (((ee_ptr_int)(x)-1) & ~3)) 129 | 130 | /* Configuration : SEED_METHOD 131 | Defines method to get seed values that cannot be computed at compile 132 | time. 133 | 134 | Valid values : 135 | SEED_ARG - from command line. 136 | SEED_FUNC - from a system function. 137 | SEED_VOLATILE - from volatile variables. 138 | */ 139 | #ifndef SEED_METHOD 140 | #define SEED_METHOD SEED_VOLATILE 141 | #endif 142 | 143 | /* Configuration : MEM_METHOD 144 | Defines method to get a block of memry. 145 | 146 | Valid values : 147 | MEM_MALLOC - for platforms that implement malloc and have malloc.h. 148 | MEM_STATIC - to use a static memory array. 149 | MEM_STACK - to allocate the data block on the stack (NYI). 150 | */ 151 | #ifndef MEM_METHOD 152 | #define MEM_METHOD MEM_STACK 153 | #endif 154 | 155 | #undef MEM_LOCATION 156 | #if MEM_METHOD == MEM_MALLOC 157 | # define MEM_LOCATION "MALLOC" 158 | #elif MEM_METHOD == MEM_STATIC 159 | # define MEM_LOCATION "STATIC" 160 | #elif MEM_METHOD == MEM_STACK 161 | # define MEM_LOCATION "STACK" 162 | #endif 163 | 164 | 165 | /* Configuration : MULTITHREAD 166 | Define for parallel execution 167 | 168 | Valid values : 169 | 1 - only one context (default). 170 | N>1 - will execute N copies in parallel. 171 | 172 | Note : 173 | If this flag is defined to more then 1, an implementation for launching 174 | parallel contexts must be defined. 175 | 176 | Two sample implementations are provided. Use or 177 | to enable them. 178 | 179 | It is valid to have a different implementation of 180 | and in , to fit a particular architecture. 181 | */ 182 | #ifndef MULTITHREAD 183 | #define MULTITHREAD 1 184 | #define USE_PTHREAD 0 185 | #define USE_FORK 0 186 | #define USE_SOCKET 0 187 | #endif 188 | 189 | /* Configuration : MAIN_HAS_NOARGC 190 | Needed if platform does not support getting arguments to main. 191 | 192 | Valid values : 193 | 0 - argc/argv to main is supported 194 | 1 - argc/argv to main is not supported 195 | 196 | Note : 197 | This flag only matters if MULTITHREAD has been defined to a value 198 | greater then 1. 199 | */ 200 | #ifndef MAIN_HAS_NOARGC 201 | #define MAIN_HAS_NOARGC 0 202 | #endif 203 | 204 | /* Configuration : MAIN_HAS_NORETURN 205 | Needed if platform does not support returning a value from main. 206 | 207 | Valid values : 208 | 0 - main returns an int, and return value will be 0. 209 | 1 - platform does not support returning a value from main 210 | */ 211 | #ifndef MAIN_HAS_NORETURN 212 | #define MAIN_HAS_NORETURN 0 213 | #endif 214 | 215 | #ifndef ITERATIONS 216 | #define ITERATIONS 3000 217 | #endif 218 | 219 | /* Variable : default_num_contexts 220 | Not used for this simple port, must contain the value 1. 221 | */ 222 | extern ee_u32 default_num_contexts; 223 | 224 | typedef struct CORE_PORTABLE_S 225 | { 226 | ee_u8 portable_id; 227 | } core_portable; 228 | 229 | void coremark_main(void); 230 | 231 | /* target specific init/fini */ 232 | void portable_init(core_portable *p, int *argc, char *argv[]); 233 | void portable_fini(core_portable *p); 234 | 235 | #if !defined(PROFILE_RUN) && !defined(PERFORMANCE_RUN) \ 236 | && !defined(VALIDATION_RUN) 237 | #if (TOTAL_DATA_SIZE == 1200) 238 | #define PROFILE_RUN 1 239 | #elif (TOTAL_DATA_SIZE == 2000) 240 | #define PERFORMANCE_RUN 1 241 | #else 242 | #define VALIDATION_RUN 1 243 | #endif 244 | #endif 245 | 246 | #endif /* CORE_PORTME_H */ 247 | -------------------------------------------------------------------------------- /project/mdk/arm_2d_scene_bubble_charging.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009-2024 Arm Limited. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | /*============================ INCLUDES ======================================*/ 20 | 21 | #if defined(_RTE_) 22 | # include "RTE_Components.h" 23 | #endif 24 | 25 | #if defined(RTE_Acceleration_Arm_2D_Helper_PFB) 26 | 27 | #include "arm_2d.h" 28 | 29 | #define __USER_SCENE_BUBBLE_CHARGING_IMPLEMENT__ 30 | #include "arm_2d_scene_bubble_charging.h" 31 | 32 | #include "arm_2d_helper.h" 33 | #include "arm_2d_example_controls.h" 34 | 35 | #include 36 | #include 37 | 38 | #if defined(__clang__) 39 | # pragma clang diagnostic push 40 | # pragma clang diagnostic ignored "-Wunknown-warning-option" 41 | # pragma clang diagnostic ignored "-Wreserved-identifier" 42 | # pragma clang diagnostic ignored "-Wsign-conversion" 43 | # pragma clang diagnostic ignored "-Wpadded" 44 | # pragma clang diagnostic ignored "-Wcast-qual" 45 | # pragma clang diagnostic ignored "-Wcast-align" 46 | # pragma clang diagnostic ignored "-Wmissing-field-initializers" 47 | # pragma clang diagnostic ignored "-Wgnu-zero-variadic-macro-arguments" 48 | # pragma clang diagnostic ignored "-Wmissing-prototypes" 49 | # pragma clang diagnostic ignored "-Wunused-variable" 50 | # pragma clang diagnostic ignored "-Wgnu-statement-expression" 51 | # pragma clang diagnostic ignored "-Wdeclaration-after-statement" 52 | # pragma clang diagnostic ignored "-Wunused-function" 53 | # pragma clang diagnostic ignored "-Wmissing-declarations" 54 | #elif __IS_COMPILER_ARM_COMPILER_5__ 55 | # pragma diag_suppress 64,177 56 | #elif __IS_COMPILER_IAR__ 57 | # pragma diag_suppress=Pa089,Pe188,Pe177,Pe174 58 | #elif __IS_COMPILER_GCC__ 59 | # pragma GCC diagnostic push 60 | # pragma GCC diagnostic ignored "-Wformat=" 61 | # pragma GCC diagnostic ignored "-Wpedantic" 62 | # pragma GCC diagnostic ignored "-Wunused-function" 63 | # pragma GCC diagnostic ignored "-Wunused-variable" 64 | # pragma GCC diagnostic ignored "-Wincompatible-pointer-types" 65 | #endif 66 | 67 | /*============================ MACROS ========================================*/ 68 | 69 | #if __GLCD_CFG_COLOUR_DEPTH__ == 8 70 | 71 | # define c_tileCMSISLogo c_tileCMSISLogoGRAY8 72 | 73 | #elif __GLCD_CFG_COLOUR_DEPTH__ == 16 74 | 75 | # define c_tileCMSISLogo c_tileCMSISLogoRGB565 76 | 77 | #elif __GLCD_CFG_COLOUR_DEPTH__ == 32 78 | 79 | # define c_tileCMSISLogo c_tileCMSISLogoCCCA8888 80 | #else 81 | # error Unsupported colour depth! 82 | #endif 83 | 84 | /*============================ MACROFIED FUNCTIONS ===========================*/ 85 | #undef this 86 | #define this (*ptThis) 87 | 88 | /*============================ TYPES =========================================*/ 89 | /*============================ GLOBAL VARIABLES ==============================*/ 90 | 91 | extern const arm_2d_tile_t c_tileCMSISLogo; 92 | extern const arm_2d_tile_t c_tileCMSISLogoMask; 93 | extern const arm_2d_tile_t c_tileCMSISLogoA2Mask; 94 | extern const arm_2d_tile_t c_tileCMSISLogoA4Mask; 95 | extern const arm_2d_tile_t c_tileQuaterArcMask; 96 | extern const arm_2d_tile_t c_tileBigWhiteDotMask; 97 | extern const arm_2d_tile_t c_tileWhiteDotMiddleMask; 98 | extern const arm_2d_tile_t c_tileRadialGradientMask; 99 | extern const arm_2d_tile_t c_tileGlassBallMask; 100 | extern const arm_2d_tile_t c_tileHallowOutCircleMask; 101 | extern const arm_2d_tile_t c_tileSinWaveMask; 102 | 103 | /*============================ PROTOTYPES ====================================*/ 104 | extern 105 | struct { 106 | implement(arm_2d_user_font_t); 107 | arm_2d_char_idx_t tUTF8Table; 108 | } ARM_2D_FONT_ALARM_CLOCK_32_A4; 109 | 110 | /*============================ LOCAL VARIABLES ===============================*/ 111 | 112 | static arm_2d_size_t c_tChargingArea = {0}; 113 | static const arm_2d_tile_t *s_ptileQuaterArcMask = &c_tileQuaterArcMask; 114 | 115 | /*============================ IMPLEMENTATION ================================*/ 116 | 117 | static void __on_scene_bubble_charging_load(arm_2d_scene_t *ptScene) 118 | { 119 | user_scene_bubble_charging_t *ptThis = (user_scene_bubble_charging_t *)ptScene; 120 | ARM_2D_UNUSED(ptThis); 121 | 122 | } 123 | 124 | static void __on_scene_bubble_charging_depose(arm_2d_scene_t *ptScene) 125 | { 126 | user_scene_bubble_charging_t *ptThis = (user_scene_bubble_charging_t *)ptScene; 127 | ARM_2D_UNUSED(ptThis); 128 | 129 | ptScene->ptPlayer = NULL; 130 | 131 | arm_foreach(int64_t,this.lTimestamp, ptItem) { 132 | *ptItem = 0; 133 | } 134 | 135 | dynamic_nebula_depose(&this.tNebula); 136 | 137 | ARM_2D_OP_DEPOSE(this.tBlurOP); 138 | 139 | if (!this.bUserAllocated) { 140 | __arm_2d_free_scratch_memory(ARM_2D_MEM_TYPE_UNSPECIFIED, ptScene); 141 | } 142 | } 143 | 144 | /*----------------------------------------------------------------------------* 145 | * Scene bubble_charging * 146 | *----------------------------------------------------------------------------*/ 147 | 148 | static void __on_scene_bubble_charging_background_start(arm_2d_scene_t *ptScene) 149 | { 150 | user_scene_bubble_charging_t *ptThis = (user_scene_bubble_charging_t *)ptScene; 151 | ARM_2D_UNUSED(ptThis); 152 | 153 | } 154 | 155 | static void __on_scene_bubble_charging_background_complete(arm_2d_scene_t *ptScene) 156 | { 157 | user_scene_bubble_charging_t *ptThis = (user_scene_bubble_charging_t *)ptScene; 158 | ARM_2D_UNUSED(ptThis); 159 | 160 | } 161 | 162 | 163 | static void __on_scene_bubble_charging_frame_start(arm_2d_scene_t *ptScene) 164 | { 165 | user_scene_bubble_charging_t *ptThis = (user_scene_bubble_charging_t *)ptScene; 166 | ARM_2D_UNUSED(ptThis); 167 | int32_t nResult; 168 | 169 | do { 170 | /* simulate a full battery charging/discharge cycle */ 171 | arm_2d_helper_time_cos_slider(0, 1000, 120000, 0, &nResult, &this.lTimestamp[1]); 172 | 173 | this.iSoC = nResult; 174 | } while(0); 175 | 176 | if (arm_2d_helper_is_time_out(10, &this.lTimestamp[2])) { 177 | 178 | if (this.iWaveOffset++ >= c_tileSinWaveMask.tRegion.tSize.iWidth) { 179 | this.iWaveOffset = 0; 180 | } 181 | } 182 | 183 | } 184 | 185 | static void __on_scene_bubble_charging_frame_complete(arm_2d_scene_t *ptScene) 186 | { 187 | user_scene_bubble_charging_t *ptThis = (user_scene_bubble_charging_t *)ptScene; 188 | ARM_2D_UNUSED(ptThis); 189 | 190 | // /* switch to next scene after 30s */ 191 | // if (arm_2d_helper_is_time_out(30000, &this.lTimestamp[0])) { 192 | // arm_2d_scene_player_switch_to_next_scene(ptScene->ptPlayer); 193 | // } 194 | 195 | arm_2d_scratch_memory_free(&this.tBlurOP.tScratchMemory); 196 | 197 | } 198 | 199 | static void __before_scene_bubble_charging_switching_out(arm_2d_scene_t *ptScene) 200 | { 201 | user_scene_bubble_charging_t *ptThis = (user_scene_bubble_charging_t *)ptScene; 202 | ARM_2D_UNUSED(ptThis); 203 | 204 | } 205 | 206 | static 207 | IMPL_PFB_ON_DRAW(__pfb_draw_scene_bubble_charging_handler) 208 | { 209 | ARM_2D_PARAM(pTarget); 210 | ARM_2D_PARAM(ptTile); 211 | ARM_2D_PARAM(bIsNewFrame); 212 | 213 | user_scene_bubble_charging_t *ptThis = (user_scene_bubble_charging_t *)pTarget; 214 | arm_2d_size_t tScreenSize = ptTile->tRegion.tSize; 215 | 216 | ARM_2D_UNUSED(tScreenSize); 217 | 218 | 219 | arm_2d_canvas(ptTile, __charging_canvas) { 220 | /*-----------------------draw the foreground begin-----------------------*/ 221 | 222 | 223 | arm_2d_align_centre(__charging_canvas, c_tileHallowOutCircleMask.tRegion.tSize) { 224 | 225 | draw_liquid_wave( ptTile, & 226 | __centre_region, 227 | this.iSoC, 228 | this.iWaveOffset, 229 | (arm_2d_margin_t){0}, 230 | GLCD_COLOR_GREEN, 231 | &c_tileSinWaveMask); 232 | 233 | arm_2d_fill_colour_with_mask( 234 | ptTile, 235 | &__centre_region, 236 | &c_tileHallowOutCircleMask, 237 | (__arm_2d_color_t) {GLCD_COLOR_BLACK}); 238 | 239 | ARM_2D_OP_WAIT_ASYNC(); 240 | 241 | } 242 | 243 | /* show nebula */ 244 | dynamic_nebula_show(&this.tNebula, 245 | ptTile, 246 | &__charging_canvas, 247 | GLCD_COLOR_WHITE, 248 | 255, 249 | bIsNewFrame); 250 | 251 | if (bIsNewFrame) { 252 | 253 | if (NULL == arm_2d_scratch_memory_new( 254 | &this.tBlurOP.tScratchMemory, 255 | sizeof(__arm_2d_iir_blur_acc_t), 256 | ( __charging_canvas.tSize.iHeight 257 | + __charging_canvas.tSize.iWidth), 258 | __alignof__(__arm_2d_iir_blur_acc_t), 259 | ARM_2D_MEM_TYPE_FAST)) { 260 | assert(false); /* insufficient memory */ 261 | } 262 | 263 | } 264 | 265 | arm_2dp_filter_iir_blur(&this.tBlurOP, 266 | ptTile, 267 | &__charging_canvas, 268 | 255 - 16); 269 | 270 | arm_2d_align_centre(__charging_canvas, c_tileGlassBallMask.tRegion.tSize) { 271 | 272 | arm_2d_fill_colour_with_mask_and_opacity( 273 | ptTile, 274 | &__centre_region, 275 | &c_tileGlassBallMask, 276 | (__arm_2d_color_t) {GLCD_COLOR_WHITE}, 277 | 255); 278 | 279 | } 280 | 281 | arm_2d_size_t tStringSize = arm_lcd_get_string_line_box("00", &ARM_2D_FONT_ALARM_CLOCK_32_A4); 282 | 283 | arm_2d_align_centre(__charging_canvas, tStringSize) { 284 | 285 | arm_lcd_text_set_draw_region(&__centre_region); 286 | arm_lcd_text_set_font((const arm_2d_font_t *)&ARM_2D_FONT_ALARM_CLOCK_32_A4); 287 | arm_lcd_text_set_colour(GLCD_COLOR_WHITE, GLCD_COLOR_BLACK); 288 | 289 | arm_lcd_printf("%02d", (this.iSoC / 10)); 290 | 291 | arm_lcd_text_set_font(NULL); 292 | 293 | __centre_region.tLocation.iX += tStringSize.iWidth + 6; 294 | __centre_region.tLocation.iY += tStringSize.iHeight - 8; 295 | arm_lcd_text_set_draw_region(&__centre_region); 296 | arm_lcd_text_set_colour(__RGB(0, 128, 0), GLCD_COLOR_BLACK); 297 | arm_lcd_printf("%%"); 298 | } 299 | 300 | /*-----------------------draw the foreground end -----------------------*/ 301 | } 302 | arm_2d_op_wait_async(NULL); 303 | 304 | return arm_fsm_rt_cpl; 305 | } 306 | 307 | static 308 | void __draw_bubble_handler( void *pObj, 309 | dynamic_nebula_t *ptDN, 310 | const arm_2d_tile_t *ptTile, 311 | arm_2d_location_t tLocation, 312 | uint8_t chOpacity, 313 | int16_t iDistance) 314 | { 315 | user_scene_bubble_charging_t *ptThis = (user_scene_bubble_charging_t *)pObj; 316 | 317 | iDistance -= s_ptileQuaterArcMask->tRegion.tSize.iWidth; 318 | 319 | 320 | arm_2d_region_t tBubbleRegion = c_tileRadialGradientMask.tRegion; 321 | tBubbleRegion.tLocation.iX = tLocation.iX - c_tileRadialGradientMask.tRegion.tSize.iWidth / 2; 322 | tBubbleRegion.tLocation.iY = tLocation.iY - c_tileRadialGradientMask.tRegion.tSize.iHeight / 2; 323 | 324 | uint8_t chOriginalOpacity = 256 - chOpacity; 325 | 326 | if (iDistance > 16) { 327 | chOpacity = chOriginalOpacity; 328 | } else { 329 | chOpacity = MIN((iDistance << 4), chOriginalOpacity); 330 | } 331 | 332 | arm_2d_fill_colour_with_mask_and_opacity(ptTile, 333 | &tBubbleRegion, 334 | &c_tileRadialGradientMask, 335 | (__arm_2d_color_t){GLCD_COLOR_GREEN}, 336 | chOpacity); 337 | } 338 | 339 | ARM_NONNULL(1) 340 | user_scene_bubble_charging_t *__arm_2d_scene_bubble_charging_init( arm_2d_scene_player_t *ptDispAdapter, 341 | user_scene_bubble_charging_t *ptThis) 342 | { 343 | bool bUserAllocated = false; 344 | assert(NULL != ptDispAdapter); 345 | 346 | c_tChargingArea = s_ptileQuaterArcMask->tRegion.tSize; 347 | c_tChargingArea.iWidth *= 4; 348 | c_tChargingArea.iHeight *= 4; 349 | 350 | /* get the screen region */ 351 | arm_2d_region_t tScreen 352 | = arm_2d_helper_pfb_get_display_area( 353 | &ptDispAdapter->use_as__arm_2d_helper_pfb_t); 354 | 355 | if (NULL == ptThis) { 356 | ptThis = (user_scene_bubble_charging_t *) 357 | __arm_2d_allocate_scratch_memory( sizeof(user_scene_bubble_charging_t), 358 | __alignof__(user_scene_bubble_charging_t), 359 | ARM_2D_MEM_TYPE_UNSPECIFIED); 360 | assert(NULL != ptThis); 361 | if (NULL == ptThis) { 362 | return NULL; 363 | } 364 | } else { 365 | bUserAllocated = true; 366 | } 367 | 368 | memset(ptThis, 0, sizeof(user_scene_bubble_charging_t)); 369 | 370 | *ptThis = (user_scene_bubble_charging_t){ 371 | .use_as__arm_2d_scene_t = { 372 | 373 | /* the canvas colour */ 374 | .tCanvas = {GLCD_COLOR_BLACK}, 375 | 376 | /* Please uncommon the callbacks if you need them 377 | */ 378 | .fnOnLoad = &__on_scene_bubble_charging_load, 379 | .fnScene = &__pfb_draw_scene_bubble_charging_handler, 380 | //.ptDirtyRegion = (arm_2d_region_list_item_t *)s_tDirtyRegions, 381 | 382 | 383 | //.fnOnBGStart = &__on_scene_bubble_charging_background_start, 384 | //.fnOnBGComplete = &__on_scene_bubble_charging_background_complete, 385 | .fnOnFrameStart = &__on_scene_bubble_charging_frame_start, 386 | //.fnBeforeSwitchOut = &__before_scene_bubble_charging_switching_out, 387 | .fnOnFrameCPL = &__on_scene_bubble_charging_frame_complete, 388 | .fnDepose = &__on_scene_bubble_charging_depose, 389 | 390 | .bUseDirtyRegionHelper = false, 391 | }, 392 | .bUserAllocated = bUserAllocated, 393 | }; 394 | 395 | /* ------------ initialize members of user_scene_bubble_charging_t begin ---------------*/ 396 | do { 397 | int16_t iRadius = MIN(tScreen.tSize.iHeight, tScreen.tSize.iWidth) / 2; 398 | dynamic_nebula_cfg_t tCFG = { 399 | .fSpeed = 0.5f, 400 | .iRadius = iRadius, 401 | .iVisibleRingWidth = iRadius - s_ptileQuaterArcMask->tRegion.tSize.iWidth, 402 | .hwParticleCount = dimof(this.tParticles), 403 | .ptParticles = this.tParticles, 404 | 405 | .evtOnDrawParticles = { 406 | .fnHandler = &__draw_bubble_handler, 407 | .pTarget = ptThis, 408 | }, 409 | }; 410 | dynamic_nebula_init(&this.tNebula, &tCFG); 411 | } while(0); 412 | 413 | ARM_2D_OP_INIT(this.tBlurOP); 414 | 415 | /* ------------ initialize members of user_scene_bubble_charging_t end ---------------*/ 416 | 417 | arm_2d_scene_player_append_scenes( ptDispAdapter, 418 | &this.use_as__arm_2d_scene_t, 419 | 1); 420 | 421 | return ptThis; 422 | } 423 | 424 | 425 | #if defined(__clang__) 426 | # pragma clang diagnostic pop 427 | #endif 428 | 429 | #endif 430 | 431 | 432 | -------------------------------------------------------------------------------- /project/mdk/arm_2d_scene_bubble_charging.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009-2024 Arm Limited. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #ifndef __ARM_2D_SCENE_BUBBLE_CHARGING_H__ 20 | #define __ARM_2D_SCENE_BUBBLE_CHARGING_H__ 21 | 22 | /*============================ INCLUDES ======================================*/ 23 | 24 | #if defined(_RTE_) 25 | # include "RTE_Components.h" 26 | #endif 27 | 28 | #if defined(RTE_Acceleration_Arm_2D_Helper_PFB) 29 | 30 | #include "arm_2d.h" 31 | 32 | #include "arm_2d_helper_scene.h" 33 | #include "arm_2d_example_controls.h" 34 | 35 | #ifdef __cplusplus 36 | extern "C" { 37 | #endif 38 | 39 | #if defined(__clang__) 40 | # pragma clang diagnostic push 41 | # pragma clang diagnostic ignored "-Wunknown-warning-option" 42 | # pragma clang diagnostic ignored "-Wreserved-identifier" 43 | # pragma clang diagnostic ignored "-Wmissing-declarations" 44 | # pragma clang diagnostic ignored "-Wpadded" 45 | #elif __IS_COMPILER_ARM_COMPILER_5__ 46 | #elif __IS_COMPILER_GCC__ 47 | # pragma GCC diagnostic push 48 | # pragma GCC diagnostic ignored "-Wformat=" 49 | # pragma GCC diagnostic ignored "-Wpedantic" 50 | # pragma GCC diagnostic ignored "-Wpadded" 51 | #endif 52 | 53 | /*============================ MACROS ========================================*/ 54 | 55 | /* OOC header, please DO NOT modify */ 56 | #ifdef __USER_SCENE_BUBBLE_CHARGING_IMPLEMENT__ 57 | # undef __USER_SCENE_BUBBLE_CHARGING_IMPLEMENT__ 58 | # define __ARM_2D_IMPL__ 59 | #endif 60 | #include "arm_2d_utils.h" 61 | 62 | /*============================ MACROFIED FUNCTIONS ===========================*/ 63 | 64 | /*! 65 | * \brief initalize scene_bubble_charging and add it to a user specified scene player 66 | * \param[in] __DISP_ADAPTER_PTR the target display adapter (i.e. scene player) 67 | * \param[in] ... this is an optional parameter. When it is NULL, a new 68 | * user_scene_bubble_charging_t will be allocated from HEAP and freed on 69 | * the deposing event. When it is non-NULL, the life-cycle is managed 70 | * by user. 71 | * \return user_scene_bubble_charging_t* the user_scene_bubble_charging_t instance 72 | */ 73 | #define arm_2d_scene_bubble_charging_init(__DISP_ADAPTER_PTR, ...) \ 74 | __arm_2d_scene_bubble_charging_init((__DISP_ADAPTER_PTR), (NULL, ##__VA_ARGS__)) 75 | 76 | /*============================ TYPES =========================================*/ 77 | /*! 78 | * \brief a user class for scene bubble_charging 79 | */ 80 | typedef struct user_scene_bubble_charging_t user_scene_bubble_charging_t; 81 | 82 | struct user_scene_bubble_charging_t { 83 | implement(arm_2d_scene_t); //! derived from class: arm_2d_scene_t 84 | 85 | ARM_PRIVATE( 86 | /* place your private member here, following two are examples */ 87 | int64_t lTimestamp[3]; 88 | 89 | arm_2d_filter_iir_blur_descriptor_t tBlurOP; 90 | dynamic_nebula_t tNebula; 91 | dynamic_nebula_particle_t tParticles[10]; 92 | 93 | bool bUserAllocated; 94 | 95 | int16_t iWaveOffset; 96 | int16_t iSoC; //!< state of the charge (1000 ‰) 97 | 98 | ) 99 | /* place your public member here */ 100 | 101 | }; 102 | 103 | /*============================ GLOBAL VARIABLES ==============================*/ 104 | /*============================ PROTOTYPES ====================================*/ 105 | 106 | ARM_NONNULL(1) 107 | extern 108 | user_scene_bubble_charging_t *__arm_2d_scene_bubble_charging_init( arm_2d_scene_player_t *ptDispAdapter, 109 | user_scene_bubble_charging_t *ptScene); 110 | 111 | #if defined(__clang__) 112 | # pragma clang diagnostic pop 113 | #elif __IS_COMPILER_GCC__ 114 | # pragma GCC diagnostic pop 115 | #endif 116 | 117 | #ifdef __cplusplus 118 | } 119 | #endif 120 | 121 | #endif 122 | 123 | #endif 124 | -------------------------------------------------------------------------------- /project/mdk/debug_with_cmsis-dap.ini: -------------------------------------------------------------------------------- 1 | 2 | FUNC void reset_pico(void) 3 | { 4 | exec("RESET"); 5 | exec("G, Reset_Handler"); 6 | } 7 | 8 | DEFINE BUTTON "Reset Pico", "reset_pico()" 9 | 10 | reset_pico(); -------------------------------------------------------------------------------- /project/mdk/debug_with_cmsis-dap_in_ram.ini: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | FUNC void debug_from_ram(void) 5 | { 6 | //extern unsigned int Image$$ARM_LIB_STACK$$ZI$$Limit; 7 | 8 | printf("Entry Point: %08x\r\n", Reset_Handler); 9 | printf("Main Stack Pointer: %08x\r\n", Image$$ARM_LIB_STACK$$ZI$$Limit); 10 | 11 | /* 12 | typedef struct { 13 | unsigned int ctrl; 14 | unsigned int load; 15 | unsigned int reason; 16 | unsigned int scratch[8]; 17 | unsigned int tick; 18 | } watchdog_hw_t; 19 | 20 | #define watchdog_hw ((watchdog_hw_t *const)0x40058000) 21 | */ 22 | 23 | _WWORD(0x4005801C ,0xb007c0d3); //! scratch 4 24 | _WWORD(0x40058020 ,-0xb007c0d3 ^ (Reset_Handler | 0x01)); //! scratch 5 25 | _WWORD(0x40058024 ,Image$$ARM_LIB_STACK$$ZI$$Limit); //! scratch 6 26 | _WWORD(0x40058028 ,Reset_Handler | 0x01); //! scratch 7 27 | 28 | exec("RESET"); 29 | //exec("BS main"); 30 | //exec("G, Reset_Handler"); 31 | exec("G, main"); 32 | } 33 | 34 | DEFINE BUTTON "Reset Pico", "debug_from_ram()" 35 | 36 | debug_from_ram(); 37 | -------------------------------------------------------------------------------- /project/mdk/template.uvoptx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 1.0 5 | 6 |
### uVision Project, (C) Keil Software
7 | 8 | 9 | *.c 10 | *.s*; *.src; *.a* 11 | *.obj; *.o 12 | *.lib 13 | *.txt; *.h; *.inc; *.md 14 | *.plm 15 | *.cpp; *.cc; *.cxx 16 | 0 17 | 18 | 19 | 20 | 0 21 | 0 22 | 23 | 24 | 25 | AC6-flash 26 | 0x4 27 | ARM-ADS 28 | 29 | 12000000 30 | 31 | 1 32 | 1 33 | 0 34 | 1 35 | 0 36 | 37 | 38 | 1 39 | 65535 40 | 0 41 | 0 42 | 0 43 | 44 | 45 | 79 46 | 66 47 | 8 48 | .\Listings\ 49 | 50 | 51 | 1 52 | 1 53 | 1 54 | 0 55 | 1 56 | 1 57 | 0 58 | 1 59 | 0 60 | 0 61 | 0 62 | 0 63 | 64 | 65 | 1 66 | 1 67 | 1 68 | 1 69 | 1 70 | 1 71 | 1 72 | 0 73 | 0 74 | 75 | 76 | 1 77 | 0 78 | 1 79 | 80 | 255 81 | 82 | 0 83 | 1 84 | 1 85 | 0 86 | 1 87 | 1 88 | 1 89 | 1 90 | 1 91 | 1 92 | 1 93 | 1 94 | 1 95 | 1 96 | 0 97 | 1 98 | 1 99 | 1 100 | 1 101 | 0 102 | 0 103 | 1 104 | 0 105 | 0 106 | 3 107 | 108 | 109 | 110 | 111 | .\debug.ini 112 | 113 | 114 | 115 | 116 | .\debug_with_cmsis-dap.ini 117 | BIN\CMSIS_AGDI.dll 118 | 119 | 120 | 121 | 0 122 | UL2CM3 123 | UL2CM3(-S0 -C0 -P0 -FN1 -FC2000 -FD20040000 -FF0Raspberry_Pi_Pico -FL0200000 -FS010000000 -FP0($$Device:RP2040$CMSIS\Flash\Raspberry_Pi_Pico.FLM) 124 | 125 | 126 | 0 127 | CMSIS_AGDI 128 | -X"CMSIS-DAP" -UE6605481DB701F35 -O198 -S8 -C0 -P00000000 -N00("ARM CoreSight SW-DP") -D00(0BC12477) -L00(0) -TO65554 -TC10000000 -TT10000000 -TP20 -TDS8007 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -FO7 -FD20040000 -FC2000 -FN1 -FF0Raspberry_Pi_Pico.FLM -FS010000000 -FL0200000 -FP0($$Device:RP2040$CMSIS\Flash\Raspberry_Pi_Pico.FLM) 129 | 130 | 131 | 0 132 | DLGTARM 133 | (1010=724,527,1135,1029,0)(1007=-1,-1,-1,-1,0)(1008=-1,-1,-1,-1,0)(1012=-1,-1,-1,-1,0)(1009=120,153,364,299,0) 134 | 135 | 136 | 0 137 | DLGUARM 138 | 139 | 140 | 141 | 0 142 | ARMRTXEVENTFLAGS 143 | -L70 -Z18 -C0 -M0 -T1 144 | 145 | 146 | 0 147 | DLGDARM 148 | (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) 149 | 150 | 151 | 0 152 | ARMDBGFLAGS 153 | -T0 154 | 155 | 156 | 157 | 158 | 159 | 0 160 | 1 161 | SystemCoreClock,0x0A 162 | 163 | 164 | 165 | 166 | 1 167 | 1 168 | 0x4005801C 169 | 0 170 | 171 | 172 | 173 | C:\Users\gabriel\AppData\Local\Arm\Packs\ARM\CMSIS-View\1.2.0\EventRecorder\EventRecorder.scvd 174 | ARM::CMSIS-View@1.2.0 175 | 1 176 | 177 | 178 | 179 | 0 180 | Reset Pico 181 | reset_pico() 182 | 183 | 184 | 185 | 0 186 | 187 | 188 | 0 189 | 1 190 | 0 191 | 0 192 | 0 193 | 0 194 | 0 195 | 1 196 | 0 197 | 0 198 | 1 199 | 0 200 | 0 201 | 0 202 | 0 203 | 0 204 | 0 205 | 0 206 | 0 207 | 1 208 | 0 209 | 0 210 | 0 211 | 0 212 | 213 | 214 | 215 | 0 216 | 0 217 | 0 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 0 228 | 1 229 | 0 230 | 2 231 | 10000000 232 | 233 | 234 | 235 | 236 | 237 | AC6-DebugInSRAM 238 | 0x4 239 | ARM-ADS 240 | 241 | 12000000 242 | 243 | 1 244 | 1 245 | 0 246 | 1 247 | 0 248 | 249 | 250 | 1 251 | 65535 252 | 0 253 | 0 254 | 0 255 | 256 | 257 | 79 258 | 66 259 | 8 260 | .\Listings\ 261 | 262 | 263 | 1 264 | 1 265 | 1 266 | 0 267 | 1 268 | 1 269 | 0 270 | 1 271 | 0 272 | 0 273 | 0 274 | 0 275 | 276 | 277 | 1 278 | 1 279 | 1 280 | 1 281 | 1 282 | 1 283 | 1 284 | 0 285 | 0 286 | 287 | 288 | 1 289 | 0 290 | 0 291 | 292 | 255 293 | 294 | 0 295 | 1 296 | 1 297 | 0 298 | 1 299 | 1 300 | 1 301 | 1 302 | 1 303 | 1 304 | 1 305 | 1 306 | 1 307 | 1 308 | 0 309 | 1 310 | 1 311 | 1 312 | 1 313 | 0 314 | 0 315 | 1 316 | 0 317 | 0 318 | 3 319 | 320 | 321 | 322 | 323 | .\debug.ini 324 | 325 | 326 | 327 | 328 | .\debug_with_cmsis-dap_in_ram.ini 329 | BIN\CMSIS_AGDI.dll 330 | 331 | 332 | 333 | 0 334 | CMSIS_AGDI 335 | -X"Any" -UAny -O206 -S8 -C0 -P00000000 -N00("ARM CoreSight SW-DP") -D00(0BC12477) -L00(0) -TO65554 -TC10000000 -TT10000000 -TP20 -TDS8007 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -FO7 -FD20040000 -FC2000 -FN1 -FF0Raspberry_Pi_Pico.FLM -FS010000000 -FL0200000 -FP0($$Device:RP2040$CMSIS\Flash\Raspberry_Pi_Pico.FLM) 336 | 337 | 338 | 0 339 | UL2CM3 340 | UL2CM3(-S0 -C0 -P0 -FN1 -FC2000 -FD20040000 -FF0Raspberry_Pi_Pico -FL0200000 -FS010000000 -FP0($$Device:RP2040$CMSIS\Flash\Raspberry_Pi_Pico.FLM) 341 | 342 | 343 | 0 344 | DLGTARM 345 | (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) 346 | 347 | 348 | 0 349 | DLGUARM 350 | 351 | 352 | 353 | 0 354 | ARMRTXEVENTFLAGS 355 | -L70 -Z18 -C0 -M0 -T1 356 | 357 | 358 | 0 359 | DLGDARM 360 | (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) 361 | 362 | 363 | 0 364 | ARMDBGFLAGS 365 | -T0 366 | 367 | 368 | 369 | 370 | 371 | 1 372 | 1 373 | 0x2000AC00 374 | 0 375 | 376 | 377 | 378 | C:\Users\gabriel\AppData\Local\Arm\Packs\ARM\CMSIS-View\1.2.0\EventRecorder\EventRecorder.scvd 379 | ARM::CMSIS-View@1.2.0 380 | 1 381 | 382 | 383 | 384 | 0 385 | Reset Pico 386 | debug_from_ram() 387 | 388 | 389 | 390 | 0 391 | 392 | 393 | 0 394 | 1 395 | 0 396 | 0 397 | 0 398 | 0 399 | 0 400 | 1 401 | 0 402 | 0 403 | 1 404 | 0 405 | 0 406 | 0 407 | 0 408 | 0 409 | 0 410 | 0 411 | 0 412 | 0 413 | 0 414 | 0 415 | 0 416 | 0 417 | 418 | 419 | 420 | 0 421 | 0 422 | 0 423 | 424 | 425 | 426 | 427 | 428 | 429 | 430 | 431 | 432 | 0 433 | 1 434 | 0 435 | 2 436 | 10000000 437 | 438 | 439 | 440 | 441 | 442 | Application 443 | 1 444 | 0 445 | 0 446 | 0 447 | 448 | 1 449 | 1 450 | 1 451 | 0 452 | 0 453 | 0 454 | ..\..\main.c 455 | main.c 456 | 0 457 | 0 458 | 459 | 460 | 461 | 462 | BSP 463 | 1 464 | 0 465 | 0 466 | 0 467 | 468 | 2 469 | 2 470 | 5 471 | 0 472 | 0 473 | 0 474 | ..\..\bsp\bsp.h 475 | bsp.h 476 | 0 477 | 0 478 | 479 | 480 | 2 481 | 3 482 | 4 483 | 0 484 | 0 485 | 0 486 | ..\..\bsp\lib\RP2040_bsp.lib 487 | RP2040_bsp.lib 488 | 0 489 | 0 490 | 491 | 492 | 2 493 | 4 494 | 1 495 | 0 496 | 0 497 | 0 498 | ..\..\bsp\rp2040_bsp_default.c 499 | rp2040_bsp_default.c 500 | 0 501 | 0 502 | 503 | 504 | 505 | 506 | ::CMSIS 507 | 0 508 | 0 509 | 0 510 | 1 511 | 512 | 513 | 514 | ::CMSIS-Compiler 515 | 0 516 | 0 517 | 0 518 | 1 519 | 520 | 521 | 522 | ::CMSIS-View 523 | 1 524 | 0 525 | 0 526 | 1 527 | 528 | 529 | 530 | ::Device 531 | 0 532 | 0 533 | 0 534 | 1 535 | 536 | 537 | 538 | ::Utilities 539 | 1 540 | 0 541 | 0 542 | 1 543 | 544 | 545 |
546 | --------------------------------------------------------------------------------