├── .github
└── workflows
│ └── cmake-single-platform.yml
├── .gitignore
├── .readthedocs.yaml
├── LICENSE
├── README.md
├── cmsis-pack
└── kk.MicroBoot.0.9.7.pack
├── docs
├── 3rd-party
│ ├── Arm-2D
│ │ └── arm_2d.md
│ ├── fsm
│ │ └── fsm.md
│ └── plooc
│ │ └── plooc.md
├── about
│ ├── about.md
│ └── team.md
├── bootloader
│ └── BootLoader.md
├── components
│ ├── bootloader
│ │ └── bootloader.md
│ ├── flash_blob
│ │ └── flash_blob.md
│ ├── msg_map
│ │ └── msg_map.md
│ ├── msgmap
│ │ └── msgmap.md
│ ├── queue
│ │ └── queue.md
│ ├── shell
│ │ └── shell.md
│ ├── signals_slots
│ │ └── signals_slots.md
│ ├── subscribe_publish
│ │ └── subscribe_publish.md
│ └── ymodem
│ │ └── ymodem.md
├── contribute
│ ├── code.md
│ └── document.md
├── css
│ └── custom.css
├── images
│ ├── .$NewUpada.drawio.bkp
│ ├── .$NewUpada1.drawio.bkp
│ ├── .$flash.drawio.bkp
│ ├── .$flash_user.drawio.bkp
│ ├── .$frame.drawio.bkp
│ ├── .$updata.drawio.bkp
│ ├── NewUpada.drawio
│ ├── NewUpada.png
│ ├── NewUpada1.drawio
│ ├── NewUpada1.png
│ ├── USB_1.jpg
│ ├── USB_2.png
│ ├── USB_3.png
│ ├── USB_4.jpg
│ ├── components
│ │ ├── queue
│ │ │ ├── for.jpg
│ │ │ └── queue.jpg
│ │ └── signals_slots
│ │ │ └── signals_slots.png
│ ├── favicon.ico
│ ├── flash.drawio
│ ├── flash.png
│ ├── flash_user.drawio
│ ├── flash_user.png
│ ├── frame.drawio
│ ├── frame.png
│ ├── microlink
│ │ ├── .$RTT.drawio.bkp
│ │ ├── .$RTT_printf.drawio.bkp
│ │ ├── 10M.png
│ │ ├── 10M_Baud.jpg
│ │ ├── 10M_TTL.jpg
│ │ ├── ARMLINK.png
│ │ ├── ARMLINK1.jpg
│ │ ├── DEBUG.png
│ │ ├── DETAILS.png
│ │ ├── EventDebug.jpg
│ │ ├── EventPrint.png
│ │ ├── EventRE.png
│ │ ├── EventRE1.png
│ │ ├── FAIL.png
│ │ ├── FLM.jpg
│ │ ├── FLMTool.png
│ │ ├── JLINK_Download.jpg
│ │ ├── JLINK_V12_Download.jpg
│ │ ├── JTAG.jpg
│ │ ├── KZB.jpg
│ │ ├── MAX_Clock.jpg
│ │ ├── MicroLink.jpg
│ │ ├── MicroLink1.jpg
│ │ ├── MicroLink_Download.jpg
│ │ ├── MicroLink_Download.png
│ │ ├── MicroLink_Jlink.jpg
│ │ ├── RTT.drawio
│ │ ├── RTT.jpg
│ │ ├── RTTView.jpg
│ │ ├── RTTView_CMD.jpg
│ │ ├── RTTView_baiduyun.jpg
│ │ ├── RTT_Draw.jpg
│ │ ├── RTT_MAP.jpg
│ │ ├── RTT_printf.drawio
│ │ ├── RTT_printf.jpg
│ │ ├── SEGGER_JLINK.png
│ │ ├── SES1.jpg
│ │ ├── SES2.jpg
│ │ ├── SES3.jpg
│ │ ├── SJTB.png
│ │ ├── STM32F4_FLM.jpg
│ │ ├── STM32FLMO.jpg
│ │ ├── SWD.jpg
│ │ ├── SystemViewInfo.jpg
│ │ ├── SystemViewLink1.jpg
│ │ ├── SystemViewLink2.jpg
│ │ ├── SystemViewLink3.jpg
│ │ ├── SystemViewLink4.jpg
│ │ ├── SystemViewMap.jpg
│ │ ├── SystemViewPag.jpg
│ │ ├── SystemViewPag_last.jpg
│ │ ├── SystemViewUart.jpg
│ │ ├── SystemViewdemo.jpg
│ │ ├── Upan.png
│ │ ├── WX.jpg
│ │ ├── XZSF.jpg
│ │ ├── clk.jpg
│ │ ├── daoban.png
│ │ ├── data_flow.jpg
│ │ ├── defective.png
│ │ ├── error1.png
│ │ ├── error2.png
│ │ ├── flmo.jpg
│ │ ├── hook.jpg
│ │ ├── jscope.jpg
│ │ ├── load_offline.jpg
│ │ ├── loadbin.png
│ │ ├── mLinksysemView.jpg
│ │ ├── microlink.pack.png
│ │ ├── printf.png
│ │ ├── python.jpg
│ │ ├── readdocs.png
│ │ ├── rtt_code.jpg
│ │ ├── sct.jpg
│ │ ├── sct1.jpg
│ │ ├── shebei.png
│ │ ├── sin.gif
│ │ ├── sin.jpg
│ │ ├── sine.jpg
│ │ ├── sine_add.jpg
│ │ ├── systemView.jpg
│ │ └── weixin.jpg
│ ├── quick-start
│ │ ├── cmsis_pack.png
│ │ ├── cmsis_pack_10.jpg
│ │ ├── cmsis_pack_11.jpg
│ │ ├── cmsis_pack_12.jpg
│ │ ├── cmsis_pack_13.png
│ │ ├── cmsis_pack_14.jpg
│ │ ├── cmsis_pack_15.jpg
│ │ ├── cmsis_pack_16.png
│ │ ├── cmsis_pack_17.png
│ │ ├── cmsis_pack_18.jpg
│ │ ├── cmsis_pack_2.png
│ │ ├── cmsis_pack_3.jpg
│ │ ├── cmsis_pack_4.jpg
│ │ ├── cmsis_pack_5.jpg
│ │ ├── cmsis_pack_6.jpg
│ │ ├── cmsis_pack_7.jpg
│ │ ├── cmsis_pack_8.png
│ │ └── cmsis_pack_9.png
│ ├── updata.drawio
│ └── updata.png
├── index.md
├── quick-start
│ ├── RT-Thread.md
│ ├── cmsis-pack.md
│ ├── quick-start.md
│ └── troubleshooting.md
├── requirements.txt
├── tools
│ └── microlink
│ │ ├── Mlink_PikaPython.md
│ │ ├── RTT_printf.md
│ │ ├── SystemView.md
│ │ ├── microlink.md
│ │ ├── offline_download.md
│ │ └── python_api.md
├── usage-guide
│ └── config.md
└── utilities
│ ├── FLM.md
│ ├── ParameterMacro.md
│ └── ThreadSafety.md
├── example
├── flash
│ ├── Template_FLASH_DEV.c
│ └── Template_FLASH_DRV.c
└── ymodem
│ ├── intelhex
│ ├── intelhex.c
│ └── intelhex.h
│ ├── ymodem_ota.c
│ ├── ymodem_ota.h
│ ├── ymodem_receive.c
│ ├── ymodem_receive.h
│ ├── ymodem_send.c
│ └── ymodem_send.h
├── gen_pack.sh
├── kk.MicroBoot.pdsc
├── mkdocs.yml
├── source
├── IPC
│ ├── critical
│ │ ├── critical.c
│ │ └── critical.h
│ └── event
│ │ ├── app_cfg.h
│ │ ├── event.c
│ │ └── event.h
├── app_cfg.h
├── bootloader
│ ├── app_cfg.h
│ ├── bootloader.c
│ └── bootloader.h
├── check_agent_engine
│ ├── app_cfg.h
│ ├── check_agent_engine.c
│ └── check_agent_engine.h
├── communication
│ ├── app_cfg.h
│ ├── frame
│ │ ├── simple_frame.c
│ │ └── simple_frame.h
│ ├── msg_map
│ │ ├── app_cfg.h
│ │ ├── msg_check_arg.c
│ │ ├── msg_check_arg.h
│ │ ├── msg_check_str.c
│ │ ├── msg_check_str.h
│ │ ├── msg_get_byte.h
│ │ ├── msg_map.c
│ │ └── msg_map.h
│ ├── shell
│ │ ├── app_cfg.h
│ │ ├── finsh.h
│ │ ├── micro_shell.c
│ │ ├── micro_shell.h
│ │ ├── micro_shell_cmd.c
│ │ └── vt100
│ │ │ ├── app_cfg.h
│ │ │ └── vt100.c
│ ├── signals_slots
│ │ ├── app_cfg.h
│ │ ├── signals_slots.c
│ │ └── signals_slots.h
│ ├── subscribe_publish
│ │ ├── app_cfg.h
│ │ ├── subscribe_publish.c
│ │ └── subscribe_publish.h
│ └── ymodem
│ │ ├── app_cfg.h
│ │ ├── ymodem.c
│ │ └── ymodem.h
├── flash_algo
│ ├── app_cfg.h
│ ├── flash
│ │ ├── GD32_FLASH_DEV.c
│ │ ├── GD32_FLASH_DRV.c
│ │ ├── HC32_FLASH_DEV.c
│ │ ├── HC32_FLASH_DRV.c
│ │ ├── HPM_FLASH_DEV.c
│ │ ├── HPM_FLASH_DRV.c
│ │ ├── STM32_FLASH_DEV.c
│ │ └── STM32_FLASH_DRV.c
│ ├── flash_algo.c
│ └── flash_algo.h
├── fsm
│ ├── ooc.h
│ └── simple_fsm.h
├── generic
│ ├── app_cfg.h
│ ├── list
│ │ └── app_cfg.h
│ ├── pool
│ │ ├── app_cfg.h
│ │ ├── mem_pool.c
│ │ └── mem_pool.h
│ └── queue
│ │ ├── app_cfg.h
│ │ ├── ring_queue.c
│ │ └── ring_queue.h
├── microboot.h
├── plooc
│ ├── LICENSE
│ ├── README.md
│ ├── plooc.h
│ ├── plooc_class.h
│ ├── plooc_class_black_box.h
│ ├── plooc_class_simple.h
│ └── plooc_class_strict.h
└── soft_timer
│ └── app_cfg.h
└── template
├── no_semihosting.c
└── user_app_cfg.h
/.github/workflows/cmake-single-platform.yml:
--------------------------------------------------------------------------------
1 | name: Build documentation and pack
2 |
3 | on:
4 | workflow_dispatch:
5 | push:
6 | branches: [ main ]
7 | pull_request:
8 | branches: [ main ]
9 | release:
10 | types: [published]
11 |
12 | jobs:
13 | pack:
14 | name: Generate pack
15 | runs-on: ubuntu-24.04
16 | steps:
17 | - name: Checkout repository
18 | uses: actions/checkout@v3
19 | with:
20 | fetch-depth: 0
21 |
22 | - name: Fetch tags
23 | if: ${{ github.event_name == 'release' }}
24 | run: |
25 | git fetch --tags --force
26 |
27 | - name: Setup Node.js
28 | uses: actions/setup-node@v2
29 | with:
30 | node-version: '20'
31 |
32 | - name: Make gen_pack.sh executable
33 | run: chmod +x ./gen_pack.sh
34 |
35 | - name: Generate Pack
36 | uses: Open-CMSIS-Pack/gen-pack-action@main
37 | with:
38 | doxygen-version: 1.9.5
39 | packchk-version: 1.3.96
40 | gen-pack-script: ./gen_pack.sh
41 | gen-pack-output: ./output
42 |
--------------------------------------------------------------------------------
/.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 | *.exe
33 | *.out
34 | *.app
35 | *.i*86
36 | *.x86_64
37 | *.hex
38 |
39 | # Debug files
40 | *.dSYM/
41 | *.su
42 | *.idb
43 | *.pdb
44 |
45 | # Kernel Module Compile Results
46 | *.mod*
47 | *.cmd
48 | .tmp_versions/
49 | modules.order
50 | Module.symvers
51 | Mkfile.old
52 | dkms.conf
53 |
--------------------------------------------------------------------------------
/.readthedocs.yaml:
--------------------------------------------------------------------------------
1 | # Read the Docs configuration file for MkDocs projects
2 | # See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
3 |
4 | # Required
5 | version: 2
6 |
7 | # Set the version of Python and other tools you might need
8 | build:
9 | os: ubuntu-22.04
10 | tools:
11 | python: "3.10"
12 |
13 | mkdocs:
14 | configuration: mkdocs.yml
15 |
16 | # Optionally declare the Python requirements required to build your docs
17 | python:
18 | install:
19 | - requirements: docs/requirements.txt
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # MicroBoot
2 |
3 | MicroBoot 是一个由模块化代码组成的框架,旨在简化和加速嵌入式单片机程序的升级和开发过程。
4 |
5 | 文档介绍:
6 |
7 | https://microboot.readthedocs.io/zh-cn/latest/
--------------------------------------------------------------------------------
/cmsis-pack/kk.MicroBoot.0.9.7.pack:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aladdin-Wang/MicroBoot/2f802e24538da61bdd53ca84dad730084afaca03/cmsis-pack/kk.MicroBoot.0.9.7.pack
--------------------------------------------------------------------------------
/docs/3rd-party/Arm-2D/arm_2d.md:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aladdin-Wang/MicroBoot/2f802e24538da61bdd53ca84dad730084afaca03/docs/3rd-party/Arm-2D/arm_2d.md
--------------------------------------------------------------------------------
/docs/3rd-party/fsm/fsm.md:
--------------------------------------------------------------------------------
1 | # FSM
2 |
3 | 123
--------------------------------------------------------------------------------
/docs/3rd-party/plooc/plooc.md:
--------------------------------------------------------------------------------
1 | # PLOOC
2 |
3 | ---
4 |
5 | 123
6 |
--------------------------------------------------------------------------------
/docs/about/about.md:
--------------------------------------------------------------------------------
1 | # About
2 |
3 | Learn more about our project and its goals...
4 |
--------------------------------------------------------------------------------
/docs/about/team.md:
--------------------------------------------------------------------------------
1 | # The Team
2 |
3 | Meet the awesome team behind the project...
4 |
--------------------------------------------------------------------------------
/docs/bootloader/BootLoader.md:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aladdin-Wang/MicroBoot/2f802e24538da61bdd53ca84dad730084afaca03/docs/bootloader/BootLoader.md
--------------------------------------------------------------------------------
/docs/components/bootloader/bootloader.md:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aladdin-Wang/MicroBoot/2f802e24538da61bdd53ca84dad730084afaca03/docs/components/bootloader/bootloader.md
--------------------------------------------------------------------------------
/docs/components/flash_blob/flash_blob.md:
--------------------------------------------------------------------------------
1 | # flash-blob
2 |
3 | ---
--------------------------------------------------------------------------------
/docs/components/msg_map/msg_map.md:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aladdin-Wang/MicroBoot/2f802e24538da61bdd53ca84dad730084afaca03/docs/components/msg_map/msg_map.md
--------------------------------------------------------------------------------
/docs/components/msgmap/msgmap.md:
--------------------------------------------------------------------------------
1 | # msgmap
2 |
3 | ---
--------------------------------------------------------------------------------
/docs/components/shell/shell.md:
--------------------------------------------------------------------------------
1 | # shell
2 |
3 | ---
--------------------------------------------------------------------------------
/docs/components/subscribe_publish/subscribe_publish.md:
--------------------------------------------------------------------------------
1 | # 宏魔法第二弹——打造一个发布订阅模块
2 |
3 | 信号槽是同步通讯,如果改造成异步通讯
4 |
5 | 。。。
6 |
7 | 需要增加队列
8 |
9 | 。。。
10 |
11 | 需要检测字符串
12 |
13 | 。。。
14 |
15 | 需要一个消息地图
16 |
17 | 。。。
18 |
19 | 组成异步调用
20 |
21 | 。。。
22 |
23 | 新名字——>发布订阅
--------------------------------------------------------------------------------
/docs/components/ymodem/ymodem.md:
--------------------------------------------------------------------------------
1 | # ymodem
2 |
3 | ---
--------------------------------------------------------------------------------
/docs/contribute/code.md:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aladdin-Wang/MicroBoot/2f802e24538da61bdd53ca84dad730084afaca03/docs/contribute/code.md
--------------------------------------------------------------------------------
/docs/contribute/document.md:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aladdin-Wang/MicroBoot/2f802e24538da61bdd53ca84dad730084afaca03/docs/contribute/document.md
--------------------------------------------------------------------------------
/docs/css/custom.css:
--------------------------------------------------------------------------------
1 | /* 导航栏整体样式 */
2 | .md-nav {
3 | background-color: #f0f0f0; /* 灰色背景 */
4 | color: #333333; /* 深灰色文字 */
5 | font-family: 'Roboto', sans-serif; /* 使用 Roboto 字体 */
6 | font-size: 14px; /* 较小的文字大小 */
7 | box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1); /* 轻微阴影 */
8 | }
9 |
10 | /* 导航项的样式 */
11 | .md-nav__link {
12 | padding: 6px 10px; /* 缩小间距 */
13 | display: block;
14 | color: #333333;
15 | text-decoration: none;
16 | transition: color 0.3s ease;
17 | border-radius: 4px;
18 | }
19 |
20 | /* 鼠标悬停效果 */
21 | .md-nav__link:hover {
22 | background-color: #e0e0e0; /* 浅灰色背景 */
23 | color: #000000; /* 黑色文字 */
24 | text-decoration: none;
25 | }
26 |
27 | /* 激活状态下的导航项 */
28 | .md-nav__link--active {
29 | font-weight: bold; /* 加粗字体 */
30 | color: #000000; /* 深色字体 */
31 | }
32 |
33 | /* 子导航项的样式 */
34 | .md-nav__link--nested {
35 | padding-left: 15px; /* 更小的子项缩进 */
36 | font-size: 13px; /* 更小的文字大小 */
37 | color: #555555; /* 较浅的灰色 */
38 | }
39 |
40 | /* 修改导航栏的间距和布局 */
41 | .md-nav__list {
42 | padding: 5px; /* 缩小整体间距 */
43 | margin: 0;
44 | list-style-type: none; /* 去除默认列表样式 */
45 | }
46 |
47 | /* 自定义搜索框样式 */
48 | .md-search__input {
49 | width: 100%;
50 | padding: 8px 12px;
51 | border: 1px solid #cccccc;
52 | border-radius: 4px;
53 | margin-bottom: 10px;
54 | transition: border-color 0.3s ease;
55 | }
56 |
57 | .md-search__input:focus {
58 | border-color: #000000; /* 聚焦时边框颜色 */
59 | outline: none;
60 | }
61 |
--------------------------------------------------------------------------------
/docs/images/.$NewUpada.drawio.bkp:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
--------------------------------------------------------------------------------
/docs/images/.$NewUpada1.drawio.bkp:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
--------------------------------------------------------------------------------
/docs/images/NewUpada.drawio:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
--------------------------------------------------------------------------------
/docs/images/NewUpada.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aladdin-Wang/MicroBoot/2f802e24538da61bdd53ca84dad730084afaca03/docs/images/NewUpada.png
--------------------------------------------------------------------------------
/docs/images/NewUpada1.drawio:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
--------------------------------------------------------------------------------
/docs/images/NewUpada1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aladdin-Wang/MicroBoot/2f802e24538da61bdd53ca84dad730084afaca03/docs/images/NewUpada1.png
--------------------------------------------------------------------------------
/docs/images/USB_1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aladdin-Wang/MicroBoot/2f802e24538da61bdd53ca84dad730084afaca03/docs/images/USB_1.jpg
--------------------------------------------------------------------------------
/docs/images/USB_2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aladdin-Wang/MicroBoot/2f802e24538da61bdd53ca84dad730084afaca03/docs/images/USB_2.png
--------------------------------------------------------------------------------
/docs/images/USB_3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aladdin-Wang/MicroBoot/2f802e24538da61bdd53ca84dad730084afaca03/docs/images/USB_3.png
--------------------------------------------------------------------------------
/docs/images/USB_4.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aladdin-Wang/MicroBoot/2f802e24538da61bdd53ca84dad730084afaca03/docs/images/USB_4.jpg
--------------------------------------------------------------------------------
/docs/images/components/queue/for.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aladdin-Wang/MicroBoot/2f802e24538da61bdd53ca84dad730084afaca03/docs/images/components/queue/for.jpg
--------------------------------------------------------------------------------
/docs/images/components/queue/queue.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aladdin-Wang/MicroBoot/2f802e24538da61bdd53ca84dad730084afaca03/docs/images/components/queue/queue.jpg
--------------------------------------------------------------------------------
/docs/images/components/signals_slots/signals_slots.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aladdin-Wang/MicroBoot/2f802e24538da61bdd53ca84dad730084afaca03/docs/images/components/signals_slots/signals_slots.png
--------------------------------------------------------------------------------
/docs/images/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aladdin-Wang/MicroBoot/2f802e24538da61bdd53ca84dad730084afaca03/docs/images/favicon.ico
--------------------------------------------------------------------------------
/docs/images/flash.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aladdin-Wang/MicroBoot/2f802e24538da61bdd53ca84dad730084afaca03/docs/images/flash.png
--------------------------------------------------------------------------------
/docs/images/flash_user.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aladdin-Wang/MicroBoot/2f802e24538da61bdd53ca84dad730084afaca03/docs/images/flash_user.png
--------------------------------------------------------------------------------
/docs/images/frame.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aladdin-Wang/MicroBoot/2f802e24538da61bdd53ca84dad730084afaca03/docs/images/frame.png
--------------------------------------------------------------------------------
/docs/images/microlink/.$RTT_printf.drawio.bkp:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
--------------------------------------------------------------------------------
/docs/images/microlink/10M.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aladdin-Wang/MicroBoot/2f802e24538da61bdd53ca84dad730084afaca03/docs/images/microlink/10M.png
--------------------------------------------------------------------------------
/docs/images/microlink/10M_Baud.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aladdin-Wang/MicroBoot/2f802e24538da61bdd53ca84dad730084afaca03/docs/images/microlink/10M_Baud.jpg
--------------------------------------------------------------------------------
/docs/images/microlink/10M_TTL.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aladdin-Wang/MicroBoot/2f802e24538da61bdd53ca84dad730084afaca03/docs/images/microlink/10M_TTL.jpg
--------------------------------------------------------------------------------
/docs/images/microlink/ARMLINK.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aladdin-Wang/MicroBoot/2f802e24538da61bdd53ca84dad730084afaca03/docs/images/microlink/ARMLINK.png
--------------------------------------------------------------------------------
/docs/images/microlink/ARMLINK1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aladdin-Wang/MicroBoot/2f802e24538da61bdd53ca84dad730084afaca03/docs/images/microlink/ARMLINK1.jpg
--------------------------------------------------------------------------------
/docs/images/microlink/DEBUG.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aladdin-Wang/MicroBoot/2f802e24538da61bdd53ca84dad730084afaca03/docs/images/microlink/DEBUG.png
--------------------------------------------------------------------------------
/docs/images/microlink/DETAILS.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aladdin-Wang/MicroBoot/2f802e24538da61bdd53ca84dad730084afaca03/docs/images/microlink/DETAILS.png
--------------------------------------------------------------------------------
/docs/images/microlink/EventDebug.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aladdin-Wang/MicroBoot/2f802e24538da61bdd53ca84dad730084afaca03/docs/images/microlink/EventDebug.jpg
--------------------------------------------------------------------------------
/docs/images/microlink/EventPrint.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aladdin-Wang/MicroBoot/2f802e24538da61bdd53ca84dad730084afaca03/docs/images/microlink/EventPrint.png
--------------------------------------------------------------------------------
/docs/images/microlink/EventRE.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aladdin-Wang/MicroBoot/2f802e24538da61bdd53ca84dad730084afaca03/docs/images/microlink/EventRE.png
--------------------------------------------------------------------------------
/docs/images/microlink/EventRE1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aladdin-Wang/MicroBoot/2f802e24538da61bdd53ca84dad730084afaca03/docs/images/microlink/EventRE1.png
--------------------------------------------------------------------------------
/docs/images/microlink/FAIL.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aladdin-Wang/MicroBoot/2f802e24538da61bdd53ca84dad730084afaca03/docs/images/microlink/FAIL.png
--------------------------------------------------------------------------------
/docs/images/microlink/FLM.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aladdin-Wang/MicroBoot/2f802e24538da61bdd53ca84dad730084afaca03/docs/images/microlink/FLM.jpg
--------------------------------------------------------------------------------
/docs/images/microlink/FLMTool.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aladdin-Wang/MicroBoot/2f802e24538da61bdd53ca84dad730084afaca03/docs/images/microlink/FLMTool.png
--------------------------------------------------------------------------------
/docs/images/microlink/JLINK_Download.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aladdin-Wang/MicroBoot/2f802e24538da61bdd53ca84dad730084afaca03/docs/images/microlink/JLINK_Download.jpg
--------------------------------------------------------------------------------
/docs/images/microlink/JLINK_V12_Download.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aladdin-Wang/MicroBoot/2f802e24538da61bdd53ca84dad730084afaca03/docs/images/microlink/JLINK_V12_Download.jpg
--------------------------------------------------------------------------------
/docs/images/microlink/JTAG.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aladdin-Wang/MicroBoot/2f802e24538da61bdd53ca84dad730084afaca03/docs/images/microlink/JTAG.jpg
--------------------------------------------------------------------------------
/docs/images/microlink/KZB.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aladdin-Wang/MicroBoot/2f802e24538da61bdd53ca84dad730084afaca03/docs/images/microlink/KZB.jpg
--------------------------------------------------------------------------------
/docs/images/microlink/MAX_Clock.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aladdin-Wang/MicroBoot/2f802e24538da61bdd53ca84dad730084afaca03/docs/images/microlink/MAX_Clock.jpg
--------------------------------------------------------------------------------
/docs/images/microlink/MicroLink.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aladdin-Wang/MicroBoot/2f802e24538da61bdd53ca84dad730084afaca03/docs/images/microlink/MicroLink.jpg
--------------------------------------------------------------------------------
/docs/images/microlink/MicroLink1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aladdin-Wang/MicroBoot/2f802e24538da61bdd53ca84dad730084afaca03/docs/images/microlink/MicroLink1.jpg
--------------------------------------------------------------------------------
/docs/images/microlink/MicroLink_Download.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aladdin-Wang/MicroBoot/2f802e24538da61bdd53ca84dad730084afaca03/docs/images/microlink/MicroLink_Download.jpg
--------------------------------------------------------------------------------
/docs/images/microlink/MicroLink_Download.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aladdin-Wang/MicroBoot/2f802e24538da61bdd53ca84dad730084afaca03/docs/images/microlink/MicroLink_Download.png
--------------------------------------------------------------------------------
/docs/images/microlink/MicroLink_Jlink.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aladdin-Wang/MicroBoot/2f802e24538da61bdd53ca84dad730084afaca03/docs/images/microlink/MicroLink_Jlink.jpg
--------------------------------------------------------------------------------
/docs/images/microlink/RTT.drawio:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
--------------------------------------------------------------------------------
/docs/images/microlink/RTT.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aladdin-Wang/MicroBoot/2f802e24538da61bdd53ca84dad730084afaca03/docs/images/microlink/RTT.jpg
--------------------------------------------------------------------------------
/docs/images/microlink/RTTView.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aladdin-Wang/MicroBoot/2f802e24538da61bdd53ca84dad730084afaca03/docs/images/microlink/RTTView.jpg
--------------------------------------------------------------------------------
/docs/images/microlink/RTTView_CMD.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aladdin-Wang/MicroBoot/2f802e24538da61bdd53ca84dad730084afaca03/docs/images/microlink/RTTView_CMD.jpg
--------------------------------------------------------------------------------
/docs/images/microlink/RTTView_baiduyun.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aladdin-Wang/MicroBoot/2f802e24538da61bdd53ca84dad730084afaca03/docs/images/microlink/RTTView_baiduyun.jpg
--------------------------------------------------------------------------------
/docs/images/microlink/RTT_Draw.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aladdin-Wang/MicroBoot/2f802e24538da61bdd53ca84dad730084afaca03/docs/images/microlink/RTT_Draw.jpg
--------------------------------------------------------------------------------
/docs/images/microlink/RTT_MAP.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aladdin-Wang/MicroBoot/2f802e24538da61bdd53ca84dad730084afaca03/docs/images/microlink/RTT_MAP.jpg
--------------------------------------------------------------------------------
/docs/images/microlink/RTT_printf.drawio:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
--------------------------------------------------------------------------------
/docs/images/microlink/RTT_printf.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aladdin-Wang/MicroBoot/2f802e24538da61bdd53ca84dad730084afaca03/docs/images/microlink/RTT_printf.jpg
--------------------------------------------------------------------------------
/docs/images/microlink/SEGGER_JLINK.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aladdin-Wang/MicroBoot/2f802e24538da61bdd53ca84dad730084afaca03/docs/images/microlink/SEGGER_JLINK.png
--------------------------------------------------------------------------------
/docs/images/microlink/SES1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aladdin-Wang/MicroBoot/2f802e24538da61bdd53ca84dad730084afaca03/docs/images/microlink/SES1.jpg
--------------------------------------------------------------------------------
/docs/images/microlink/SES2.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aladdin-Wang/MicroBoot/2f802e24538da61bdd53ca84dad730084afaca03/docs/images/microlink/SES2.jpg
--------------------------------------------------------------------------------
/docs/images/microlink/SES3.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aladdin-Wang/MicroBoot/2f802e24538da61bdd53ca84dad730084afaca03/docs/images/microlink/SES3.jpg
--------------------------------------------------------------------------------
/docs/images/microlink/SJTB.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aladdin-Wang/MicroBoot/2f802e24538da61bdd53ca84dad730084afaca03/docs/images/microlink/SJTB.png
--------------------------------------------------------------------------------
/docs/images/microlink/STM32F4_FLM.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aladdin-Wang/MicroBoot/2f802e24538da61bdd53ca84dad730084afaca03/docs/images/microlink/STM32F4_FLM.jpg
--------------------------------------------------------------------------------
/docs/images/microlink/STM32FLMO.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aladdin-Wang/MicroBoot/2f802e24538da61bdd53ca84dad730084afaca03/docs/images/microlink/STM32FLMO.jpg
--------------------------------------------------------------------------------
/docs/images/microlink/SWD.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aladdin-Wang/MicroBoot/2f802e24538da61bdd53ca84dad730084afaca03/docs/images/microlink/SWD.jpg
--------------------------------------------------------------------------------
/docs/images/microlink/SystemViewInfo.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aladdin-Wang/MicroBoot/2f802e24538da61bdd53ca84dad730084afaca03/docs/images/microlink/SystemViewInfo.jpg
--------------------------------------------------------------------------------
/docs/images/microlink/SystemViewLink1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aladdin-Wang/MicroBoot/2f802e24538da61bdd53ca84dad730084afaca03/docs/images/microlink/SystemViewLink1.jpg
--------------------------------------------------------------------------------
/docs/images/microlink/SystemViewLink2.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aladdin-Wang/MicroBoot/2f802e24538da61bdd53ca84dad730084afaca03/docs/images/microlink/SystemViewLink2.jpg
--------------------------------------------------------------------------------
/docs/images/microlink/SystemViewLink3.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aladdin-Wang/MicroBoot/2f802e24538da61bdd53ca84dad730084afaca03/docs/images/microlink/SystemViewLink3.jpg
--------------------------------------------------------------------------------
/docs/images/microlink/SystemViewLink4.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aladdin-Wang/MicroBoot/2f802e24538da61bdd53ca84dad730084afaca03/docs/images/microlink/SystemViewLink4.jpg
--------------------------------------------------------------------------------
/docs/images/microlink/SystemViewMap.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aladdin-Wang/MicroBoot/2f802e24538da61bdd53ca84dad730084afaca03/docs/images/microlink/SystemViewMap.jpg
--------------------------------------------------------------------------------
/docs/images/microlink/SystemViewPag.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aladdin-Wang/MicroBoot/2f802e24538da61bdd53ca84dad730084afaca03/docs/images/microlink/SystemViewPag.jpg
--------------------------------------------------------------------------------
/docs/images/microlink/SystemViewPag_last.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aladdin-Wang/MicroBoot/2f802e24538da61bdd53ca84dad730084afaca03/docs/images/microlink/SystemViewPag_last.jpg
--------------------------------------------------------------------------------
/docs/images/microlink/SystemViewUart.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aladdin-Wang/MicroBoot/2f802e24538da61bdd53ca84dad730084afaca03/docs/images/microlink/SystemViewUart.jpg
--------------------------------------------------------------------------------
/docs/images/microlink/SystemViewdemo.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aladdin-Wang/MicroBoot/2f802e24538da61bdd53ca84dad730084afaca03/docs/images/microlink/SystemViewdemo.jpg
--------------------------------------------------------------------------------
/docs/images/microlink/Upan.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aladdin-Wang/MicroBoot/2f802e24538da61bdd53ca84dad730084afaca03/docs/images/microlink/Upan.png
--------------------------------------------------------------------------------
/docs/images/microlink/WX.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aladdin-Wang/MicroBoot/2f802e24538da61bdd53ca84dad730084afaca03/docs/images/microlink/WX.jpg
--------------------------------------------------------------------------------
/docs/images/microlink/XZSF.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aladdin-Wang/MicroBoot/2f802e24538da61bdd53ca84dad730084afaca03/docs/images/microlink/XZSF.jpg
--------------------------------------------------------------------------------
/docs/images/microlink/clk.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aladdin-Wang/MicroBoot/2f802e24538da61bdd53ca84dad730084afaca03/docs/images/microlink/clk.jpg
--------------------------------------------------------------------------------
/docs/images/microlink/daoban.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aladdin-Wang/MicroBoot/2f802e24538da61bdd53ca84dad730084afaca03/docs/images/microlink/daoban.png
--------------------------------------------------------------------------------
/docs/images/microlink/data_flow.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aladdin-Wang/MicroBoot/2f802e24538da61bdd53ca84dad730084afaca03/docs/images/microlink/data_flow.jpg
--------------------------------------------------------------------------------
/docs/images/microlink/defective.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aladdin-Wang/MicroBoot/2f802e24538da61bdd53ca84dad730084afaca03/docs/images/microlink/defective.png
--------------------------------------------------------------------------------
/docs/images/microlink/error1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aladdin-Wang/MicroBoot/2f802e24538da61bdd53ca84dad730084afaca03/docs/images/microlink/error1.png
--------------------------------------------------------------------------------
/docs/images/microlink/error2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aladdin-Wang/MicroBoot/2f802e24538da61bdd53ca84dad730084afaca03/docs/images/microlink/error2.png
--------------------------------------------------------------------------------
/docs/images/microlink/flmo.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aladdin-Wang/MicroBoot/2f802e24538da61bdd53ca84dad730084afaca03/docs/images/microlink/flmo.jpg
--------------------------------------------------------------------------------
/docs/images/microlink/hook.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aladdin-Wang/MicroBoot/2f802e24538da61bdd53ca84dad730084afaca03/docs/images/microlink/hook.jpg
--------------------------------------------------------------------------------
/docs/images/microlink/jscope.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aladdin-Wang/MicroBoot/2f802e24538da61bdd53ca84dad730084afaca03/docs/images/microlink/jscope.jpg
--------------------------------------------------------------------------------
/docs/images/microlink/load_offline.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aladdin-Wang/MicroBoot/2f802e24538da61bdd53ca84dad730084afaca03/docs/images/microlink/load_offline.jpg
--------------------------------------------------------------------------------
/docs/images/microlink/loadbin.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aladdin-Wang/MicroBoot/2f802e24538da61bdd53ca84dad730084afaca03/docs/images/microlink/loadbin.png
--------------------------------------------------------------------------------
/docs/images/microlink/mLinksysemView.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aladdin-Wang/MicroBoot/2f802e24538da61bdd53ca84dad730084afaca03/docs/images/microlink/mLinksysemView.jpg
--------------------------------------------------------------------------------
/docs/images/microlink/microlink.pack.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aladdin-Wang/MicroBoot/2f802e24538da61bdd53ca84dad730084afaca03/docs/images/microlink/microlink.pack.png
--------------------------------------------------------------------------------
/docs/images/microlink/printf.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aladdin-Wang/MicroBoot/2f802e24538da61bdd53ca84dad730084afaca03/docs/images/microlink/printf.png
--------------------------------------------------------------------------------
/docs/images/microlink/python.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aladdin-Wang/MicroBoot/2f802e24538da61bdd53ca84dad730084afaca03/docs/images/microlink/python.jpg
--------------------------------------------------------------------------------
/docs/images/microlink/readdocs.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aladdin-Wang/MicroBoot/2f802e24538da61bdd53ca84dad730084afaca03/docs/images/microlink/readdocs.png
--------------------------------------------------------------------------------
/docs/images/microlink/rtt_code.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aladdin-Wang/MicroBoot/2f802e24538da61bdd53ca84dad730084afaca03/docs/images/microlink/rtt_code.jpg
--------------------------------------------------------------------------------
/docs/images/microlink/sct.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aladdin-Wang/MicroBoot/2f802e24538da61bdd53ca84dad730084afaca03/docs/images/microlink/sct.jpg
--------------------------------------------------------------------------------
/docs/images/microlink/sct1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aladdin-Wang/MicroBoot/2f802e24538da61bdd53ca84dad730084afaca03/docs/images/microlink/sct1.jpg
--------------------------------------------------------------------------------
/docs/images/microlink/shebei.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aladdin-Wang/MicroBoot/2f802e24538da61bdd53ca84dad730084afaca03/docs/images/microlink/shebei.png
--------------------------------------------------------------------------------
/docs/images/microlink/sin.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aladdin-Wang/MicroBoot/2f802e24538da61bdd53ca84dad730084afaca03/docs/images/microlink/sin.gif
--------------------------------------------------------------------------------
/docs/images/microlink/sin.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aladdin-Wang/MicroBoot/2f802e24538da61bdd53ca84dad730084afaca03/docs/images/microlink/sin.jpg
--------------------------------------------------------------------------------
/docs/images/microlink/sine.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aladdin-Wang/MicroBoot/2f802e24538da61bdd53ca84dad730084afaca03/docs/images/microlink/sine.jpg
--------------------------------------------------------------------------------
/docs/images/microlink/sine_add.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aladdin-Wang/MicroBoot/2f802e24538da61bdd53ca84dad730084afaca03/docs/images/microlink/sine_add.jpg
--------------------------------------------------------------------------------
/docs/images/microlink/systemView.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aladdin-Wang/MicroBoot/2f802e24538da61bdd53ca84dad730084afaca03/docs/images/microlink/systemView.jpg
--------------------------------------------------------------------------------
/docs/images/microlink/weixin.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aladdin-Wang/MicroBoot/2f802e24538da61bdd53ca84dad730084afaca03/docs/images/microlink/weixin.jpg
--------------------------------------------------------------------------------
/docs/images/quick-start/cmsis_pack.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aladdin-Wang/MicroBoot/2f802e24538da61bdd53ca84dad730084afaca03/docs/images/quick-start/cmsis_pack.png
--------------------------------------------------------------------------------
/docs/images/quick-start/cmsis_pack_10.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aladdin-Wang/MicroBoot/2f802e24538da61bdd53ca84dad730084afaca03/docs/images/quick-start/cmsis_pack_10.jpg
--------------------------------------------------------------------------------
/docs/images/quick-start/cmsis_pack_11.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aladdin-Wang/MicroBoot/2f802e24538da61bdd53ca84dad730084afaca03/docs/images/quick-start/cmsis_pack_11.jpg
--------------------------------------------------------------------------------
/docs/images/quick-start/cmsis_pack_12.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aladdin-Wang/MicroBoot/2f802e24538da61bdd53ca84dad730084afaca03/docs/images/quick-start/cmsis_pack_12.jpg
--------------------------------------------------------------------------------
/docs/images/quick-start/cmsis_pack_13.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aladdin-Wang/MicroBoot/2f802e24538da61bdd53ca84dad730084afaca03/docs/images/quick-start/cmsis_pack_13.png
--------------------------------------------------------------------------------
/docs/images/quick-start/cmsis_pack_14.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aladdin-Wang/MicroBoot/2f802e24538da61bdd53ca84dad730084afaca03/docs/images/quick-start/cmsis_pack_14.jpg
--------------------------------------------------------------------------------
/docs/images/quick-start/cmsis_pack_15.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aladdin-Wang/MicroBoot/2f802e24538da61bdd53ca84dad730084afaca03/docs/images/quick-start/cmsis_pack_15.jpg
--------------------------------------------------------------------------------
/docs/images/quick-start/cmsis_pack_16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aladdin-Wang/MicroBoot/2f802e24538da61bdd53ca84dad730084afaca03/docs/images/quick-start/cmsis_pack_16.png
--------------------------------------------------------------------------------
/docs/images/quick-start/cmsis_pack_17.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aladdin-Wang/MicroBoot/2f802e24538da61bdd53ca84dad730084afaca03/docs/images/quick-start/cmsis_pack_17.png
--------------------------------------------------------------------------------
/docs/images/quick-start/cmsis_pack_18.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aladdin-Wang/MicroBoot/2f802e24538da61bdd53ca84dad730084afaca03/docs/images/quick-start/cmsis_pack_18.jpg
--------------------------------------------------------------------------------
/docs/images/quick-start/cmsis_pack_2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aladdin-Wang/MicroBoot/2f802e24538da61bdd53ca84dad730084afaca03/docs/images/quick-start/cmsis_pack_2.png
--------------------------------------------------------------------------------
/docs/images/quick-start/cmsis_pack_3.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aladdin-Wang/MicroBoot/2f802e24538da61bdd53ca84dad730084afaca03/docs/images/quick-start/cmsis_pack_3.jpg
--------------------------------------------------------------------------------
/docs/images/quick-start/cmsis_pack_4.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aladdin-Wang/MicroBoot/2f802e24538da61bdd53ca84dad730084afaca03/docs/images/quick-start/cmsis_pack_4.jpg
--------------------------------------------------------------------------------
/docs/images/quick-start/cmsis_pack_5.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aladdin-Wang/MicroBoot/2f802e24538da61bdd53ca84dad730084afaca03/docs/images/quick-start/cmsis_pack_5.jpg
--------------------------------------------------------------------------------
/docs/images/quick-start/cmsis_pack_6.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aladdin-Wang/MicroBoot/2f802e24538da61bdd53ca84dad730084afaca03/docs/images/quick-start/cmsis_pack_6.jpg
--------------------------------------------------------------------------------
/docs/images/quick-start/cmsis_pack_7.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aladdin-Wang/MicroBoot/2f802e24538da61bdd53ca84dad730084afaca03/docs/images/quick-start/cmsis_pack_7.jpg
--------------------------------------------------------------------------------
/docs/images/quick-start/cmsis_pack_8.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aladdin-Wang/MicroBoot/2f802e24538da61bdd53ca84dad730084afaca03/docs/images/quick-start/cmsis_pack_8.png
--------------------------------------------------------------------------------
/docs/images/quick-start/cmsis_pack_9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aladdin-Wang/MicroBoot/2f802e24538da61bdd53ca84dad730084afaca03/docs/images/quick-start/cmsis_pack_9.png
--------------------------------------------------------------------------------
/docs/images/updata.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aladdin-Wang/MicroBoot/2f802e24538da61bdd53ca84dad730084afaca03/docs/images/updata.png
--------------------------------------------------------------------------------
/docs/quick-start/RT-Thread.md:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aladdin-Wang/MicroBoot/2f802e24538da61bdd53ca84dad730084afaca03/docs/quick-start/RT-Thread.md
--------------------------------------------------------------------------------
/docs/quick-start/cmsis-pack.md:
--------------------------------------------------------------------------------
1 | # 基于 CMSIS-PACK 移植
2 |
3 | ## 1.准备工作
4 |
5 | 准备一份基础的裸机源码 (可通过 STM32CubeMx 可视化软件创建也可按照工程项目所需文档手动创建) 工程,如一份 stm32 包含一个支持 **printf 的串口初始化**代码。
6 |
7 | 基于CMSIS-PACK移植的DEMO例程地址:
8 |
9 | github:[https://github.com/Aladdin-Wang/MicroBoot_Demo](https://github.com/Aladdin-Wang/MicroBoot_Demo)
10 |
11 | gitee:[https://gitee.com/Aladdin-Wang/MicroBoot_Demo](https://gitee.com/Aladdin-Wang/MicroBoot_Demo)
12 |
13 | ## 2.安装Pack包
14 |
15 | 在 **MDK** 中部署 **MicroBoot **的第一步是获取对应的 **cmsis-pack**,对于可以流畅访问 Github 的朋友来说,通过下面的网址直接找到最新的 .pack 文件。
16 |
17 | [https://github.com/Aladdin-Wang/MicroBoot/releases](https://github.com/Aladdin-Wang/MicroBoot/releases)
18 |
19 | 下载结束后双击文件进行安装,一路 Next 安装即可
20 |
21 | 
22 |
23 | ## 3.添加MicroBoot到工程
24 |
25 | **步骤一:加入组件**
26 |
27 | 在 MDK 工程中通过工具栏的快捷按钮,来打开 RTE 配置窗口:
28 |
29 | 
30 |
31 | 在 Manage Rum-Time Environment 里 "Software Component" 栏找到 MicroBoot,并将其展开:
32 |
33 | 如果只想使用MicroBoot的ota功能,可以勾选ymodem_ota,如下图所示,你会发现在窗口中看到橙色的警告:
34 |
35 | 
36 |
37 | 这里警告的含义是说:**ymodem_ota**依赖了其他模块,但你没有勾选它们。简单的单击左下角的 Resolve 按钮,RTE会自动帮你勾选上所依赖的模块。
38 |
39 | 
40 |
41 | 单击“OK” 按钮完成组件的添加。
42 |
43 | 根据芯片类型选择FLASH的驱动程序:
44 |
45 | 
46 |
47 | **步骤二:配置编译环境**
48 |
49 | 如果你使用**Arm Compiler 6(armclang)**,则需要打开对**C11**和**GNU扩展**的支持,即直接在"Language C"中选择“**gnu11**”:
50 |
51 | 
52 |
53 | **步骤三:模块配置**
54 |
55 | 在工程管理器中展开 **MicroBoot**,并找到新加入的用户适配器文件(**user_app_cfg.h**),双击打开后,在编辑器的左下角选择 **Configuration Wizard**,进入图形配置界面:
56 |
57 | 
58 |
59 | 配置bootloader的参数:
60 |
61 | - The starting address of the app:从bootloader跳转到APP的地址;
62 | - The app size:APP占用FLASH的大小,必须对扇区对齐;
63 | - The Boot Flash Ops Addr:对flash进行擦写函数的地址,使用默认值;
64 |
65 | **步骤四:添加代码**
66 |
67 | 假设你以串口(其他串行外设方法类似)的方式传输数据,在usart.h中,添加信号:
68 |
69 | 
70 |
71 | 在usart.c中,添加data_msg_t的定义
72 |
73 | 
74 |
75 | 打开串口接收数据中断
76 |
77 | 
78 |
79 | 在中断接收回调函数中,发射信号:
80 |
81 | 
82 |
83 | 实现一个串口发送接口:
84 |
85 | 
86 |
87 |
88 |
89 | 在main.c中包含头文件:
90 |
91 | ```c
92 | #include "ymodem_ota.h"
93 | #include "check_agent_engine.h"
94 | ```
95 |
96 | 添加对象
97 |
98 | ```c
99 | __attribute__((aligned(32)))
100 | uint8_t s_chBuffer[2048] ;
101 | static byte_queue_t s_tCheckUsePeekQueue;
102 | static fsm(check_use_peek) s_fsmCheckUsePeek;
103 | static ymodem_ota_recive_t s_tYmodemOtaReceive;
104 | ```
105 |
106 | 实现一个获取系统运行时间的函数:
107 |
108 | ```c
109 | int64_t get_system_time_ms(void)
110 | {
111 | return HAL_GetTick();
112 | }
113 | ```
114 |
115 | 在**main()** 函数中加入代码:
116 |
117 | ```c
118 |
119 | int main(void)
120 | {
121 | /* USER CODE BEGIN 1 */
122 |
123 | /* USER CODE END 1 */
124 |
125 | /* MCU Configuration--------------------------------------------------------*/
126 |
127 | /* Reset of all peripherals, Initializes the Flash interface and the Systick. */
128 | HAL_Init();
129 |
130 | /* USER CODE BEGIN Init */
131 |
132 | /* USER CODE END Init */
133 |
134 | /* Configure the system clock */
135 | SystemClock_Config();
136 |
137 | /* USER CODE BEGIN SysInit */
138 |
139 | /* USER CODE END SysInit */
140 |
141 | /* Initialize all configured peripherals */
142 | MX_GPIO_Init();
143 | MX_USART6_UART_Init();
144 | /* USER CODE BEGIN 2 */
145 | queue_init(&s_tCheckUsePeekQueue, s_chBuffer, sizeof(s_chBuffer));
146 | init_fsm(check_use_peek, &s_fsmCheckUsePeek, args(&s_tCheckUsePeekQueue));
147 |
148 | ymodem_ota_receive_init(&s_tYmodemOtaReceive, get_read_byte_interface(&s_fsmCheckUsePeek));
149 | agent_register(&s_fsmCheckUsePeek, &s_tYmodemOtaReceive.tCheckAgent);
150 |
151 | connect(&tUartMsgObj, SIGNAL(uart_sig), &s_tCheckUsePeekQueue, SLOT(enqueue_bytes));
152 | connect(&s_tYmodemOtaReceive.tYmodemReceive, SIGNAL(ymodem_rec_sig), &huart6, SLOT(uart_sent_data));
153 |
154 | /* USER CODE END 2 */
155 |
156 | /* Infinite loop */
157 | /* USER CODE BEGIN WHILE */
158 | while (1) {
159 | /* USER CODE END WHILE */
160 |
161 | /* USER CODE BEGIN 3 */
162 | call_fsm( check_use_peek, &s_fsmCheckUsePeek );
163 | }
164 |
165 | /* USER CODE END 3 */
166 | }
167 | ```
168 |
169 | **步骤五:验证升级功能**
170 |
171 | 以上就完成了对 **MicroBoot** 模块基本功能的配置,编译下载,如果一切顺利,你应该可以在串口助手中看到3秒钟打印一个字母“C”。
172 |
173 | 
174 |
175 |
176 |
177 | 使用 Xshell等带有Ymodem协议的串口助手,来下载文件:
178 |
179 | 
180 |
181 | 
182 |
183 | 或者直接使用MicroLink进行下载,MicroLink内置Ymodem协议,将需要升级的bin文件,直接拷贝到虚拟U盘中,即可自动完成下载。
184 |
185 | 
186 |
187 |
188 |
189 | ## 4.添加shell命令行工具到工程
190 |
191 | 添加shell组件:
192 |
193 | 
194 |
195 | 在main.c中添加头文件:
196 |
197 | ```c
198 | #include "micro_shell.h"
199 |
200 | ```
201 |
202 | 添加micro_shell的对象,并实现shell读写数据的函数
203 |
204 | ```c
205 | static check_shell_t s_tShellObj;
206 | uint16_t shell_read_data(wl_shell_t *ptObj, char *pchBuffer, uint16_t hwSize)
207 | {
208 | peek_byte_t *ptReadByte = get_read_byte_interface(&s_fsmCheckUsePeek);
209 | return ptReadByte->fnGetByte(ptReadByte, (uint8_t *)pchBuffer, hwSize);
210 | }
211 |
212 | uint16_t shell_write_data(wl_shell_t *ptObj, const char *pchBuffer, uint16_t hwSize)
213 | {
214 | HAL_UART_Transmit(&huart6, (uint8_t *)pchBuffer, hwSize, 100);
215 | return hwSize;
216 | }
217 | ```
218 |
219 | 在main函数中注册shell
220 |
221 | ```c
222 | shell_ops_t s_tOps = {
223 | .fnReadData = shell_read_data,
224 | .fnWriteData = shell_write_data,
225 | };
226 | shell_init(&s_tShellObj,&s_tOps);
227 | agent_register(&s_fsmCheckUsePeek, &s_tShellObj.tCheckAgent);
228 | ```
229 |
230 | 完成以上,下载后便可使用命令行功能
231 |
232 | 
233 |
234 | ## 5.常见问题
235 | [参考](../troubleshooting.md)
236 |
237 |
--------------------------------------------------------------------------------
/docs/quick-start/quick-start.md:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aladdin-Wang/MicroBoot/2f802e24538da61bdd53ca84dad730084afaca03/docs/quick-start/quick-start.md
--------------------------------------------------------------------------------
/docs/quick-start/troubleshooting.md:
--------------------------------------------------------------------------------
1 | # 常见移植问题
2 | ## 1、串口无法发送字符`c`
3 | - 获取时间函数 `get_system_time_ms` 需要提供毫秒计时,超时3秒发送字符 `c` 依赖这个函数计时,此函数是 `weak` 定义的
4 | - 检查移植示例串口发送函数 `uart_sent_data` 使用 `connect` 连接方式是否正确,例如:
5 | ```c
6 | //连接信号与槽
7 | //#define connect(__SIG_OBJ,__SIG_NAME,__SLOT_OBJ,__SLOT_FUN) \
8 | direct_connect(__SIG_OBJ.tObject,__SIG_NAME,__SLOT_OBJ,__SLOT_FUN)
9 | //example:
10 | //connect(&tCanMsgObj,SIGNAL(can_sig),&s_tFIFOin,SLOT(enqueue_bytes));
11 |
12 | // SLOT_OBJ 不能指定为 NULL
13 | connect(&s_tYmodemOtaReceive.tYmodemReceive, SIGNAL(ymodem_rec_sig), NULL, SLOT(uart_sent_data));
14 | // SLOT_OBJ 传递非空的值即可
15 | connect(&s_tYmodemOtaReceive.tYmodemReceive, SIGNAL(ymodem_rec_sig), &huart6, SLOT(uart_sent_data));
16 |
17 | ```
18 |
19 | ## 2、使用新工程移植microboot调试没有进入`main`函数
20 | - microboot 函数修饰符 `__attribute__((constructor))` 告诉编译器在程序启动时自动调用这个函数 `enter_application` 函数主要操作 flash 检查系统状态,所以 `user_app_cfg.h` 需要根据芯片实际配置 app 启动位置和实际大小,参考:[模块配置](./quick-start/cmsis-pack.md#3.添加MicroBoot到工程)
21 | - 如果调试查看汇编发现卡在 `BKPT` 指令,那就是遇到了semihosting问题,解决这个可以参考:[Semihosting真的是嵌入式阑尾么?](https://mp.weixin.qq.com/s/lIdCRfp04I0kf0L7bHRoFQ?poc_token=HAa_w2ejsxpCqNmcvgwFyBTvDqDa6cLBjrXhu787)
22 |
23 | ## 3、使用 Ymodem 协议传输固件发现进度条不动
24 | 检查移植适配的 flash 驱动操作接口写入和擦除是否正常
25 |
--------------------------------------------------------------------------------
/docs/requirements.txt:
--------------------------------------------------------------------------------
1 | mkdocs>=1.1
2 | mkdocs-material>=8.1.3
3 | mkdocs-awesome-pages-plugin>=2.7
4 | mkdocs-redirects>=1.0
5 | pymdown-extensions>=9.2
6 |
7 |
--------------------------------------------------------------------------------
/docs/tools/microlink/RTT_printf.md:
--------------------------------------------------------------------------------
1 | # printf的终极调试大法
2 |
3 | ## 一、RTT+ MicroLink,让串口调试真正自由
4 |
5 | 在嵌入式开发中,我们总是离不开**“串口打印”**来调试。
6 |
7 | 但传统串口调试存在很多明显的痛点:
8 |
9 | - ⚡ **速度慢**:输出数据卡顿,占用CPU时间,不能在中断中使用;
10 | - 🔌 **硬件占用**:需要额外占用 MCU 的 UART 接口资源;
11 | - 🔄 **接线麻烦**:需要 USB 转串口工具 + 杜邦线接线,步骤繁琐;
12 | - 🛑 **程序跑飞即断链**:一旦程序异常,串口中断,调试无从下手;
13 | - 🚪 **资源受限**:串口数量有限,调试与功能常常冲突。
14 |
15 | ### 如何打破这些痛点?
16 |
17 | **RTT + MicroLink**完美结合了双方的优势:
18 |
19 | - **RTT**:提供高速、非侵入式的数据传输;
20 | - **MicroLink**:将 RTT 通道虚拟为标准 USB CDC 串口,不再依赖 J-Link 专属工具!
21 |
22 | **📢 让调试既拥有 RTT 的性能,又能使用任意串口助手,真正做到“即插即用,自由畅快”!**
23 |
24 | ## 二、一分钟了解 RTT 是什么、怎么用
25 |
26 | ### 1、RTT 是什么?
27 |
28 | RTT,全称 **Real Time Transfer(实时传输)**,是一种**无需中断 MCU 程序执行**,就能实现数据与主机交互的调试技术。
29 |
30 | 它通过Jlink连接,使用一种内存共享机制,将 MCU 内部的数据实时“搬运”到 PC 上。
31 |
32 | **📦 形象理解::**
33 |
34 | > 就像你在 MCU 的 RAM 里放了个“邮箱”,PC 随时来收信,MCU 照常干活,互不打扰。
35 |
36 | ### 2、RTT 的基本工作原理
37 |
38 | 🔵 **在 MCU RAM 中,有一个非常重要的结构体:**
39 |
40 | > **_SEGGER_RTT 控制块**
41 |
42 | 🔵 **它的作用是:**
43 |
44 | - 保存多个 **UpBuffer(MCU ➡ PC)** 和 **DownBuffer(PC ➡ MCU)** 的信息;
45 | - 包括每个缓冲区的起始地址、大小、写指针、读指针等。
46 |
47 | 🔵 **收发数据过程:**
48 |
49 | - **MCU发送数据** ➔ 只需把数据 `memcpy` 拷贝到 **UpBuffer** 的空闲区域;
50 | - **PC接收数据** ➔ 通过 J-Link 或 MicroLink 读取 UpBuffer 的数据;
51 | - **PC发送指令** ➔ 把数据写入 DownBuffer;
52 | - **MCU读取指令** ➔ 从 DownBuffer 中 `memcpy` 出来。
53 |
54 | 📷 由于只是内存拷贝,**整个收发过程极快,微秒级完成**,不会打断 MCU 正常工作。
55 |
56 | 
57 |
58 | ### 3、RTT 怎么用?
59 |
60 | 只需简单三步:
61 |
62 | ✅ **步骤一**:集成 RTT 源码
63 |
64 | 从 SEGGER J-Link 安装目录 `Samples/RTT` 复制以下文件到工程中,并添加头文件路径。
65 |
66 | 如我电脑上的路径:
67 |
68 | C:\Program Files (x86)\SEGGER\JLink_V632f\Samples\RTT
69 |
70 | 
71 |
72 | ✅ **步骤二**:输出日志到 RTT
73 |
74 | ```c
75 | #include "SEGGER_RTT.h"
76 | int main(void)
77 | {
78 | SEGGER_RTT_Init();
79 | SEGGER_RTT_printf(0, "hello RTT\n");
80 | while(1){
81 |
82 | }
83 | }
84 | ```
85 |
86 | ✅ **步骤三**:连接调试工具
87 |
88 | - 如果使用传统 J-Link,只能用 RTT Viewer / RTT Logger;
89 | - 如果用 MicroLink,可以用**任意串口助手**直接访问 RTT 数据!
90 |
91 | ## 三、MicroLink:释放 RTT 的真正威力
92 |
93 | ### 1. 为什么传统 RTT 调试有局限?
94 |
95 | 虽然 RTT 技术强大,但官方默认的**J-Link RTT Viewer**存在明显局限:
96 |
97 | - UI 简陋,功能单一;
98 | - 只支持专用软件,不够开放;
99 | - 不兼容 SSCOM、SecureCRT、RealTerm等强大串口工具;
100 | - 不利于自动化、生产线测试。
101 |
102 | ### 2、MicroLink 带来的创新
103 |
104 | **MicroLink突破传统**,打通了 RTT 和通用串口调试工具之间的隔阂,直接把 RTT 数据转发到 **USB CDC 虚拟串口**,让 MCU 仿佛接了一个超级快的“软串口”!
105 |
106 | 🔵 MCU端:
107 |
108 | - 继续使用 RTT 库发送日志,不需要改变一行代码。
109 |
110 | 🔵 MicroLink端:
111 |
112 | - 通过 USB CDC 映射成标准串口;
113 | - 自动扫描 MCU 内存中 **_SEGGER_RTT** 控制块地址(如 0x20000000);
114 | - 直接读写 UpBuffer / DownBuffer;
115 | - 完美支持双向通信!
116 |
117 | 🔵 PC端:
118 |
119 | - 用你最喜欢的串口助手直接连 MicroLink串口,爽快收发!
120 |
121 | 📷 **MicroLink RTT 通道示意图:**
122 |
123 | 
124 |
125 |
126 |
127 | ✅ **效果总结:**
128 |
129 | - 不再局限于官方 Viewer;
130 | - 不再受限于波特率;
131 | - 不再需要额外串口硬件和线缆;
132 | - 打开任意串口助手即用,极致灵活!
133 |
134 | ## 四、与传统串口调试的性能对比
135 |
136 | | 特性 | 串口 | RTT |
137 | | ---------- | ------------ | ----------------------------- |
138 | | 通信速率 | 低 | 高(上 MB 级别) |
139 | | 占用 CPU | 较高中断开销 | 几乎无打扰 |
140 | | 崩溃后可用 | ❌ | ✅ 可访问 RAM 数据 |
141 | | 多通道支持 | ❌ | ✅ 支持多个 Up/Down Buffer |
142 | | 使用灵活性 | 有限 | 高,可集成在 UI、日志、命令中 |
143 |
144 | ## 五、快速上手 MicroLink RTT 功能
145 |
146 | ✅ **步骤一:找到MicroLink 的 USB CDC 虚拟串口**
147 |
148 | 使用USB TypeC数据线与MicroLink连接以后,电脑设备端会弹出三个设备:
149 |
150 | 
151 |
152 | 其中端口会弹出两路串行设备:
153 |
154 | - **一路为真实的USB转串口**;
155 |
156 | - **一路为USB CDC 虚拟串口**,打开串口时,输入回车,会自动回复 `>>>`;
157 |
158 | **为了方便区分两路串口,通过USB转串口发送数据LED指示灯会闪烁,通过虚拟串口发送数据LED指示灯不会闪烁。**
159 |
160 | 
161 |
162 | ✅ **步骤二:使用串口助手类工具访问 MicroLink 的 USB CDC 虚拟串口**
163 |
164 | 比如使用SSCOM,连接MicroLink的串口,输入以下指令:
165 |
166 | ```
167 | RTTView.start(0x20000000,1024,0)
168 | ```
169 |
170 | - 0x20000000:搜索RTT控制块的起始地址;
171 | - 1024:搜寻范围大小;
172 | - 0:启动RTT的通道。
173 |
174 | 
175 |
176 | **_SEGGER_RTT** 控制块地址可以通过查看MDK编译生成的.map文件来查找,如下:
177 |
178 | 
179 |
180 | 可知,\_SEGGER_RTT在地址0x20000040处,可以通过设置搜寻的地址和大小来重新启动MicroLink的RTT功能。
181 |
182 | ## 六、总结
183 |
184 | **MicroLink + RTT = 打破束缚,畅享自由**
185 |
186 | ✅ 不限速,不限工具;
187 |
188 | ✅ 不接线,不怕飞;
189 |
190 | ✅ 不修改,不额外资源占用。
191 |
192 | 享受真正意义上的“高速、自由、无侵入”调试体验!
193 |
--------------------------------------------------------------------------------
/docs/tools/microlink/python_api.md:
--------------------------------------------------------------------------------
1 | # MicroLink Python API 列表
2 |
3 | 本列表汇总了 MicroLink 常用的 Python API 接口
4 |
5 | ---
6 |
7 | - [x] `ReadFlm.load(flm_path: str, base_addr: int, ram_addr: int = 0) -> int`
8 |
9 | 加载 FLM 算法文件。
10 |
11 | - **参数**:
12 | - `flm_path`:FLM 文件路径(通常以 `.FLM.o` 结尾)
13 | - `base_addr`:目标设备中用于烧写的 Flash 基地址
14 | - `ram_addr`:算法运行所需的 RAM 基地址(可选,默认值为 `0`)
15 |
16 | - **返回值**:
17 | - `0` 表示加载成功
18 | - 非 `0` 表示加载失败
19 |
20 | ---
21 |
22 | - [x] `load.bin(file_path: str, addr: int) -> int`
23 |
24 | 烧录二进制文件到指定地址。
25 |
26 | - **参数**:
27 | - `file_path`:待烧写的 `.bin` 文件路径
28 | - `addr`:烧写起始地址
29 |
30 | - **返回值**:
31 | - `0` 表示烧录成功
32 | - 非 `0` 表示烧录失败
33 |
34 | ---
35 |
36 | - [x] `RTTView.start(rtt_addr: int, size: int, channel: int) -> None`
37 |
38 | 启动 RTT 数据转发功能,使 PC 可通过串口查看 MCU 的 RTT 输出。
39 |
40 | - **参数**:
41 | - `rtt_addr`:RTT 控制块在 MCU RAM 中的地址(如 `0x20000000`)
42 | - `size`:寻找RTT 控制块的地址范围(如 `1024`)
43 | - `channel`:RTT 通道号(通常填 `0`)
44 |
45 | - **说明**:
46 | - 启动后,可以使用串口助手或 RTT Viewer 工具查看 MCU 的实时日志数据。
47 |
48 | ---
49 |
50 | - [x] `RTTView.stop() -> None`
51 |
52 | 停止 RTT 功能,释放相关资源。
53 |
--------------------------------------------------------------------------------
/docs/usage-guide/config.md:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aladdin-Wang/MicroBoot/2f802e24538da61bdd53ca84dad730084afaca03/docs/usage-guide/config.md
--------------------------------------------------------------------------------
/docs/utilities/FLM.md:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aladdin-Wang/MicroBoot/2f802e24538da61bdd53ca84dad730084afaca03/docs/utilities/FLM.md
--------------------------------------------------------------------------------
/docs/utilities/ThreadSafety.md:
--------------------------------------------------------------------------------
1 | # 现成安全与函数可重入
2 |
3 | ---
--------------------------------------------------------------------------------
/example/flash/Template_FLASH_DEV.c:
--------------------------------------------------------------------------------
1 | #include "flash_algo.h"
2 |
3 | static flash_dev_t const FlashDevice = {
4 | FLASH_DRV_VERS, // Driver Version, do not modify!
5 | "XXXXXX 512kB Flash", // Device Name (512kB)
6 | ONCHIP, // Device Type
7 | 0x08000000, // Device Start Address
8 | 0x00080000, // Device Size in Bytes (512kB)
9 | 0x00002000, // Programming Page Size
10 | 0, // Reserved, must be 0
11 | 0xFF, // Initial Content of Erased Memory
12 | 100, // Program Page Timeout 100 mSec
13 | 6000, // Erase Sector Timeout 6000 mSec
14 | // Specify Size and Address of Sectors
15 | 0x2000, 0x000000, // Sector Size 8kB (64 Sectors)
16 | SECTOR_END
17 | };
18 |
--------------------------------------------------------------------------------
/example/flash/Template_FLASH_DRV.c:
--------------------------------------------------------------------------------
1 | #include "flash_algo.h"
2 | #include "Template_FLASH_DEV.c"
3 | /*
4 | * Initialize Flash Programming Functions
5 | * Parameter: adr: Device Base Address
6 | * clk: Clock Frequency (Hz)
7 | * fnc: Function Code (1 - Erase, 2 - Program, 3 - Verify)
8 | * Return Value: 0 - OK, 1 - Failed
9 | */
10 |
11 | static int32_t Init(uint32_t adr, uint32_t clk, uint32_t fnc)
12 | {
13 |
14 | return (0);
15 | }
16 |
17 | /*
18 | * De-Initialize Flash Programming Functions
19 | * Parameter: fnc: Function Code (1 - Erase, 2 - Program, 3 - Verify)
20 | * Return Value: 0 - OK, 1 - Failed
21 | */
22 |
23 | static int32_t UnInit(uint32_t fnc)
24 | {
25 |
26 | return (0);
27 | }
28 |
29 | /*
30 | * Erase complete Flash Memory
31 | * Return Value: 0 - OK, 1 - Failed
32 | */
33 |
34 | static int32_t EraseChip(void)
35 | {
36 |
37 | return (0);
38 | }
39 |
40 | /*
41 | * Erase Sector in Flash Memory
42 | * Parameter: adr: Sector Address
43 | * Return Value: 0 - OK, 1 - Failed
44 | */
45 | static int32_t EraseSector(uint32_t adr)
46 | {
47 |
48 | return (0);
49 | }
50 |
51 | /*
52 | * Program Page in Flash Memory
53 | * Parameter: adr: Page Start Address
54 | * sz: Page Size
55 | * buf: Page Data
56 | * Return Value: 0 - OK, 1 - Failed
57 | */
58 | static int32_t ProgramPage(uint32_t addr, uint32_t sz, uint8_t* buf)
59 | {
60 | int32_t result = 0;
61 |
62 | return result;
63 | }
64 |
65 | const flash_algo_t onchip_flash_device = {
66 | .tFlashops.Init = Init,
67 | .tFlashops.UnInit = UnInit,
68 | .tFlashops.EraseChip = EraseChip,
69 | .tFlashops.EraseSector = EraseSector,
70 | .tFlashops.Program = ProgramPage,
71 | .tFlashops.Read = NULL,
72 | .ptFlashDev = &FlashDevice,
73 | };
74 |
75 |
--------------------------------------------------------------------------------
/example/ymodem/intelhex/intelhex.h:
--------------------------------------------------------------------------------
1 | /**
2 | * @file intelhex.h
3 | * @brief Parser for the intel hex format
4 | *
5 | * DAPLink Interface Firmware
6 | * Copyright (c) 2009-2016, ARM Limited, All Rights Reserved
7 | * SPDX-License-Identifier: Apache-2.0
8 | *
9 | * Licensed under the Apache License, Version 2.0 (the "License"); you may
10 | * not use this file except in compliance with the License.
11 | * You may obtain a copy of the License at
12 | *
13 | * http://www.apache.org/licenses/LICENSE-2.0
14 | *
15 | * Unless required by applicable law or agreed to in writing, software
16 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
17 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 | * See the License for the specific language governing permissions and
19 | * limitations under the License.
20 | */
21 |
22 | #ifndef INTELHEX_H
23 | #define INTELHEX_H
24 |
25 | /** \ingroup hexfile_parser
26 | * @{
27 | */
28 |
29 | #include
30 |
31 | #ifdef __cplusplus
32 | extern "C" {
33 | #endif
34 |
35 | /** Type of states that the parser can return
36 | * @enum hexfile_parse_status_t
37 | */
38 | typedef enum {
39 | HEX_PARSE_OK = 0, /*!< The input buffer was complete parsed and converted into the output buffer */
40 | HEX_PARSE_EOF, /*!< EOF line found in the hex file */
41 | HEX_PARSE_UNALIGNED, /*!< The address of decoded data isnt consecutive. Need to program what was returned and continue to parse the input buffer */
42 | HEX_PARSE_LINE_OVERRUN, /*!< Error state when the record length is longer than the record structure */
43 | HEX_PARSE_CKSUM_FAIL, /*!< Error state when the record checksum doesnt properly compute */
44 | HEX_PARSE_UNINIT, /*!< Default state. Return of this type is unrecoverable logic error */
45 | HEX_PARSE_FAILURE /*!< Amount of hex data to decode didnt match the parsing logics count of decoded bytes */
46 | } hexfile_parse_status_t;
47 |
48 | /** Prepare any state that is maintained for the start of a file
49 | * @param none
50 | * @return none
51 | */
52 | void reset_hex_parser(void);
53 |
54 | /** Convert a blob of hex data into its binary equivelant
55 | * @param hex_blob A block of ascii encoded hexfile data
56 | * @param hex_blob_size The amount of valid data in the hex_blob
57 | * @param hex_parse_cnt The amount of hex_blob data from the call that was parsed
58 | * @param bin_buf Buffer the decoded hex file contents goes into
59 | * @param bin_buf_size max size of the buffer
60 | * @param bin_buf_address The start address for data in the bin_buf as decoded from the hex file
61 | * @param bin_buf_cnt The amount of data in the bin_buf
62 | * @return A member of hex_parse_status_t that describes the state of decoding
63 | */
64 | hexfile_parse_status_t parse_hex_blob(const uint8_t *hex_blob, const uint32_t hex_blob_size, uint32_t *hex_parse_cnt, uint8_t *bin_buf, const uint32_t bin_buf_size, uint32_t *bin_buf_address, uint32_t *bin_buf_cnt);
65 |
66 | #ifdef __cplusplus
67 | }
68 | #endif
69 |
70 | /** @} */
71 |
72 | #endif
73 |
--------------------------------------------------------------------------------
/example/ymodem/ymodem_ota.c:
--------------------------------------------------------------------------------
1 | #include "ymodem_ota.h"
2 | #include
3 |
4 | #undef this
5 | #define this (*ptThis)
6 |
7 | __attribute__((aligned(32)))
8 | uint8_t s_chQueueBuffer[1024] ;
9 |
10 | static uint16_t ymodem_recv_file_name(ymodem_t *ptObj, uint8_t *pchBuffer, uint16_t hwSize)
11 | {
12 | ymodem_receive_t *(ptThis) = (ymodem_receive_t *)ptObj;
13 | assert(NULL != ptObj);
14 | this.wOffSet = 0;
15 | strcpy(this.chFileName, (char *)&pchBuffer[0]);
16 | this.pchFileSize = (char *)&pchBuffer[strlen(this.chFileName) + 1];
17 | this.wFileSize = atol(this.pchFileSize);
18 |
19 | printf("Ymodem file_name:%s \r\n", this.chFileName);
20 | printf("Ymodem file_size:%d \r\n", this.wFileSize);
21 |
22 | if( APP_PART_SIZE < this.wFileSize) {
23 | printf("file size outrange flash size. \r\n");
24 | return 0;
25 | }
26 | target_flash_init(APP_PART_ADDR);
27 | uint32_t wEraseSize = target_flash_erase(APP_PART_ADDR, this.wFileSize);
28 | target_flash_uninit(APP_PART_ADDR);
29 | if( wEraseSize < this.wFileSize) {
30 | printf("target flash erase error. \r\n");
31 | return 0;
32 | }
33 |
34 | printf("flash erase success:%d \r\n", wEraseSize);
35 | begin_download();
36 | return hwSize;
37 | }
38 |
39 | static uint16_t ymodem_recv_file_data(ymodem_t *ptObj, uint8_t *pchBuffer, uint16_t hwSize)
40 | {
41 | ymodem_receive_t *(ptThis) = (ymodem_receive_t *)ptObj;
42 | assert(NULL != ptObj);
43 |
44 | uint32_t wRemainLen = this.wFileSize - this.wOffSet;
45 | uint32_t wWriteLen = hwSize;
46 |
47 | if(wWriteLen > wRemainLen) {
48 | wWriteLen = wRemainLen;
49 | }
50 | target_flash_init(APP_PART_ADDR);
51 | uint16_t wWriteSize = target_flash_write(APP_PART_ADDR + this.wOffSet, pchBuffer, wWriteLen);
52 | target_flash_uninit(APP_PART_ADDR);
53 | if( wWriteSize != wWriteLen) {
54 | printf("target flash write data error. 0x%x.\r\n", wWriteSize);
55 | return 0;
56 | }
57 |
58 | uint16_t hwWriteCheck = ymodem_crc16(pchBuffer, wWriteLen);
59 | target_flash_init(APP_PART_ADDR);
60 | uint16_t wReadSize = target_flash_read(APP_PART_ADDR + this.wOffSet, pchBuffer, wWriteLen);
61 | target_flash_uninit(APP_PART_ADDR);
62 | if( wReadSize != wWriteLen) {
63 | printf("target flash wReadSize data error. 0x%x.\r\n", wReadSize);
64 | return 0;
65 | }
66 |
67 | uint16_t hwReadCheck = ymodem_crc16(pchBuffer, wWriteLen);
68 |
69 | if(hwWriteCheck != hwReadCheck) {
70 | printf("Check error. WriteCheck:0x%x ReadCheck:0x%x.\r\n", hwWriteCheck, hwReadCheck);
71 | return 0;
72 | }
73 |
74 | this.wOffSet += wWriteLen;
75 |
76 | if(this.wOffSet == this.wFileSize) {
77 | finalize_download();
78 | printf("Download firmware to flash success.\n");
79 | }
80 |
81 | return hwSize;
82 | }
83 |
84 | static uint16_t ymodem_read_data(ymodem_t *ptObj, uint8_t* pchByte, uint16_t hwSize)
85 | {
86 | ymodem_receive_t *(ptThis) = (ymodem_receive_t *)ptObj;
87 | assert(NULL != ptObj);
88 | return this.ptReadByte->fnGetByte(this.ptReadByte, pchByte, hwSize);;
89 | }
90 |
91 | static uint16_t ymodem_write_data(ymodem_t *ptObj, uint8_t* pchByte, uint16_t hwSize)
92 | {
93 | ymodem_receive_t *(ptThis) = (ymodem_receive_t *)ptObj;
94 | assert(NULL != ptObj);
95 | emit(ymodem_rec_sig, ptThis,
96 | args(
97 | pchByte,
98 | hwSize
99 | ));
100 |
101 | return hwSize;
102 | }
103 |
104 | fsm_rt_t ymodem_ota_receive(ymodem_t *ptObj)
105 | {
106 | ymodem_state_t tState = ymodem_receive(ptObj);
107 |
108 | if(tState == STATE_ON_GOING) {
109 | return fsm_rt_on_going;
110 | }else if(tState == STATE_INCORRECT_NBlk || tState == STATE_INCORRECT_CHAR) {
111 | return fsm_rt_user_req_drop;
112 | }else if(tState == STATE_TIMEOUT) {
113 | return fsm_rt_user_req_timeout;
114 | }else if(tState == STATE_FINSH ){
115 | return fsm_rt_cpl;
116 | }else {
117 | return fsm_rt_cpl;
118 | }
119 | }
120 |
121 | ymodem_ota_recive_t *ymodem_ota_receive_init(ymodem_ota_recive_t *ptObj, peek_byte_t *ptReadByte)
122 | {
123 | ymodem_ota_recive_t *(ptThis) = ptObj;
124 | assert(NULL != ptObj);
125 | this.tCheckAgent.pAgent = &this.tYmodemReceive.parent;
126 | this.tCheckAgent.fnCheck = (check_hanlder_t *)ymodem_ota_receive;
127 | this.tCheckAgent.ptNext = NULL;
128 | this.tCheckAgent.hwPeekStatus = 0;
129 | this.tCheckAgent.bIsKeepingContext = true;
130 | this.tYmodemReceive.ptReadByte = ptReadByte;
131 | ymodem_ops_t s_tOps = {
132 | .pchBuffer = s_chQueueBuffer,
133 | .hwSize = sizeof(s_chQueueBuffer),
134 | .fnOnFileData = ymodem_recv_file_data,
135 | .fnOnFilePath = ymodem_recv_file_name,
136 | .fnReadData = ymodem_read_data,
137 | .fnWriteData = ymodem_write_data
138 | };
139 | ymodem_init(&this.tYmodemReceive.parent, &s_tOps);
140 |
141 | return ptObj;
142 | }
143 |
144 |
--------------------------------------------------------------------------------
/example/ymodem/ymodem_ota.h:
--------------------------------------------------------------------------------
1 | #ifndef APPLICATIONS_CHECK_AGENT_YMODEM_RECEIVE_H_
2 | #define APPLICATIONS_CHECK_AGENT_YMODEM_RECEIVE_H_
3 | #include "microboot.h"
4 |
5 | typedef struct ymodem_receive_t {
6 | ymodem_t parent;
7 | peek_byte_t *ptReadByte;
8 | char chFileName[32];
9 | char *pchFileSize;
10 | uint32_t wFileSize;
11 | uint32_t wOffSet;
12 | SIG_SLOT_OBJ;
13 | } ymodem_receive_t;
14 |
15 | typedef struct ymodem_ota_recive_t {
16 | check_agent_t tCheckAgent;
17 | ymodem_receive_t tYmodemReceive;
18 | } ymodem_ota_recive_t;
19 |
20 | signals(ymodem_rec_sig, ymodem_receive_t *ptThis,
21 | args(
22 | uint8_t *pchByte,
23 | uint16_t hwLen
24 | ));
25 |
26 | extern
27 | ymodem_ota_recive_t *ymodem_ota_receive_init(ymodem_ota_recive_t *ptObj, peek_byte_t *ptReadByte);
28 | #endif /* APPLICATIONS_CHECK_AGENT_XMODEM_H_ */
29 |
--------------------------------------------------------------------------------
/example/ymodem/ymodem_receive.c:
--------------------------------------------------------------------------------
1 | #include "ymodem_receive.h"
2 | #include
3 | #include
4 | #include
5 | #include
6 | #include
7 |
8 | #undef this
9 | #define this (*ptThis)
10 |
11 | static ymodem_receive_t s_tYmodemReceive;
12 | static uint8_t *pchBuf = NULL;
13 | static rt_device_t dev;
14 |
15 | static uint16_t ymodem_recv_file_name(ymodem_t *ptObj, uint8_t *pchBuffer, uint16_t hwSize)
16 | {
17 | ymodem_receive_t *(ptThis) = (ymodem_receive_t *)ptObj;
18 | assert(NULL != ptObj);
19 |
20 | this.wOffSet = 0;
21 | strcpy(this.chFileName, (char *)&pchBuffer[0]);
22 | this.pchFileSize = (char *)&pchBuffer[strlen(this.chFileName) + 1];
23 | this.wFileSize = atol(this.pchFileSize);
24 |
25 | printf("Ymodem file_name:%s \r\n", this.chFileName);
26 | printf("Ymodem file_size:%d \r\n", this.wFileSize);
27 |
28 | return hwSize;
29 | }
30 |
31 | static uint16_t ymodem_recv_file_data(ymodem_t *ptObj, uint8_t *pchBuffer, uint16_t hwSize)
32 | {
33 | ymodem_receive_t *(ptThis) = (ymodem_receive_t *)ptObj;
34 | assert(NULL != ptObj);
35 |
36 |
37 | return hwSize;
38 | }
39 |
40 | static uint16_t ymodem_read_data(ymodem_t *ptObj, uint8_t* pchByte, uint16_t hwSize)
41 | {
42 | ymodem_receive_t *(ptThis) = (ymodem_receive_t *)ptObj;
43 | assert(NULL != ptObj);
44 | return rt_device_read(dev, 0, pchByte, hwSize);
45 | }
46 |
47 | static uint16_t ymodem_write_data(ymodem_t *ptObj, uint8_t* pchByte, uint16_t hwSize)
48 | {
49 | ymodem_receive_t *(ptThis) = (ymodem_receive_t *)ptObj;
50 | assert(NULL != ptObj);
51 |
52 | return rt_device_write(dev, 0, pchByte, hwSize);
53 | }
54 |
55 | static rt_err_t _rym_rx_ind(rt_device_t dev, rt_size_t size)
56 | {
57 | return 0;
58 | }
59 |
60 | int ry(void)
61 | {
62 | ymodem_state_t tYmodemState;
63 | rt_uint16_t odev_flag;
64 | rt_err_t (*odev_rx_ind)(rt_device_t dev, rt_size_t size);
65 | pchBuf = rt_malloc(1024);
66 |
67 | if (pchBuf == RT_NULL) {
68 | return 0;
69 | }
70 |
71 | ymodem_ops_t s_tOps = {
72 | .pchBuffer = pchBuf,
73 | .hwSize = 1024,
74 | .fnOnFileData = ymodem_recv_file_data,
75 | .fnOnFilePath = ymodem_recv_file_name,
76 | .fnReadData = ymodem_read_data,
77 | .fnWriteData = ymodem_write_data,
78 | };
79 | ymodem_init(&s_tYmodemReceive.parent, &s_tOps);
80 | dev = rt_console_get_device();
81 | odev_rx_ind = dev->rx_indicate;
82 | rt_device_set_rx_indicate(dev, _rym_rx_ind);
83 | odev_flag = dev->open_flag;
84 | dev->open_flag &= ~RT_DEVICE_FLAG_STREAM;
85 | rt_device_open(dev, RT_DEVICE_FLAG_INT_RX | RT_DEVICE_FLAG_RDWR);
86 |
87 | do {
88 | tYmodemState = ymodem_receive(&s_tYmodemReceive.parent);
89 | rt_thread_delay(1);
90 | } while(tYmodemState == STATE_ON_GOING || tYmodemState == STATE_INCORRECT_CHAR);
91 |
92 | rt_free(pchBuf);
93 | dev->open_flag = odev_flag;
94 | rt_device_set_rx_indicate(dev, odev_rx_ind);
95 | return 0;
96 | }
97 |
98 | MSH_CMD_EXPORT(ry, ymodem send workqueue example);
99 |
100 |
--------------------------------------------------------------------------------
/example/ymodem/ymodem_receive.h:
--------------------------------------------------------------------------------
1 | #ifndef APPLICATIONS_CHECK_AGENT_XMODEM_RECEIVE_H_
2 | #define APPLICATIONS_CHECK_AGENT_XMODEM_RECEIVE_H_
3 | #include "ymodem.h"
4 |
5 | typedef struct ymodem_receive_t {
6 | ymodem_t parent;
7 | char chFileName[32];
8 | char *pchFileSize;
9 | uint32_t wFileSize;
10 | uint32_t wOffSet;
11 | } ymodem_receive_t;
12 |
13 | extern ymodem_receive_t *ymodem_receive_init(ymodem_receive_t *ptObj);
14 |
15 | #endif /* APPLICATIONS_CHECK_AGENT_XMODEM_H_ */
16 |
--------------------------------------------------------------------------------
/example/ymodem/ymodem_send.c:
--------------------------------------------------------------------------------
1 | #include "ymodem_send.h"
2 | #include "ff.h"
3 | #include "diskio.h"
4 | #include "board.h"
5 |
6 | static FIL file;
7 |
8 | ATTR_RAMFUNC_WITH_ALIGNMENT(4)
9 | static uint8_t s_chQueueBuffer[1024] ;
10 | static uint16_t ymodem_send_file_name(ymodem_t *ptObj, uint8_t *pchBuffer, uint16_t hwSize)
11 | {
12 | static uint8_t file_count = 0;
13 | FRESULT res;
14 | ymodem_send_t *(ptThis) = (ymodem_send_t *)ptObj;
15 |
16 | if(0 == this.chfileNum) {
17 | file_count = 0;
18 | this.wFileSize = 0;
19 | this.wOffSet = 0;
20 | return 0;
21 | }
22 |
23 | res = f_open(&file, this.chFileName[file_count], FA_READ);
24 | if (res != FR_OK) {
25 | pika_platform_printf("Failed to open %s file: %d\n",this.chFileName[file_count], res);
26 | return 0;
27 | }
28 | this.wFileSize = (uint32_t)f_size(&file);
29 | sprintf((char *)pchBuffer, "%s%c%d", this.chFileName[file_count], '\0', this.wFileSize);
30 | file_count++;
31 | this.chfileNum--;
32 | return hwSize;
33 | }
34 |
35 | static uint16_t ymodem_send_file_data(ymodem_t *ptObj, uint8_t *pchBuffer, uint16_t hwSize)
36 | {
37 | FRESULT res;
38 | ymodem_send_t *(ptThis) = (ymodem_send_t *)ptObj;
39 | UINT hwReadSize;
40 | res = f_read(&file, pchBuffer, hwSize, &hwReadSize);
41 | if (res != FR_OK) {
42 | f_close(&file);
43 | printf("Failed to read file: %d\n", res);
44 | return 0;
45 | }
46 | return hwReadSize;
47 | }
48 |
49 | static uint16_t ymodem_read_data(ymodem_t *ptObj, uint8_t* pchByte, uint16_t hwSize)
50 | {
51 | ymodem_send_t *(ptThis) = (ymodem_send_t *)ptObj;
52 | uint16_t hwReceiveSize = this.ptReadByte->fnGetByte(this.ptReadByte, pchByte, hwSize);
53 | return hwReceiveSize;
54 | }
55 |
56 | static uint16_t ymodem_write_data(ymodem_t *ptObj, uint8_t* pchByte, uint16_t hwSize)
57 | {
58 | static uint8_t old_per = 0;
59 | ymodem_send_t *(ptThis) = (ymodem_send_t *)ptObj;
60 | assert(NULL != ptObj);
61 | emit(ymodem_send_sig, ptThis,
62 | args(
63 | pchByte,
64 | hwSize
65 | ));
66 | this.wOffSet += hwSize;
67 | if(this.wFileSize > 0){
68 | uint8_t progress = (this.wOffSet) * 100 / this.wFileSize;
69 | if(progress >= 100){
70 | progress = 100;
71 | }
72 | if(old_per != progress){
73 | old_per = progress;
74 | printf("load: %3d%%\r\n", progress);
75 | }
76 | }
77 | return hwSize;
78 | }
79 |
80 | fsm_rt_t ymodem_lib_send(ymodem_t *ptObj)
81 | {
82 | ymodem_state_t tState = ymodem_send(ptObj);
83 |
84 | if(tState == STATE_ON_GOING) {
85 | return fsm_rt_on_going;
86 | }else if(tState == STATE_INCORRECT_NBlk || tState == STATE_INCORRECT_CHAR) {
87 | return fsm_rt_user_req_drop;
88 | }else if(tState == STATE_TIMEOUT) {
89 | return fsm_rt_user_req_timeout;
90 | }else if(tState == STATE_FINSH ){
91 | return fsm_rt_cpl;
92 | }else {
93 | return fsm_rt_cpl;
94 | }
95 | }
96 |
97 | ymodem_lib_send_t *ymodem_lib_send_init(ymodem_lib_send_t *ptObj, peek_byte_t *ptReadByte)
98 | {
99 | ymodem_lib_send_t *(ptThis) = ptObj;
100 | assert(NULL != ptObj);
101 | this.tCheckAgent.pAgent = &this.tYmodemSent.parent;
102 | this.tCheckAgent.fnCheck = (check_hanlder_t *)ymodem_lib_send;
103 | this.tCheckAgent.ptNext = NULL;
104 | this.tCheckAgent.hwPeekStatus = 0;
105 | this.tCheckAgent.bIsKeepingContext = true;
106 | this.tYmodemSent.ptReadByte = ptReadByte;
107 | ymodem_ops_t s_tOps = {
108 | .pchBuffer = s_chQueueBuffer,
109 | .hwSize = sizeof(s_chQueueBuffer),
110 | .fnOnFileData = ymodem_send_file_data,
111 | .fnOnFilePath = ymodem_send_file_name,
112 | .fnReadData = ymodem_read_data,
113 | .fnWriteData = ymodem_write_data
114 | };
115 | ymodem_init(&this.tYmodemSent.parent, &s_tOps);
116 |
117 | return ptObj;
118 | }
119 |
120 |
--------------------------------------------------------------------------------
/example/ymodem/ymodem_send.h:
--------------------------------------------------------------------------------
1 | #ifndef APPLICATIONS_CHECK_AGENT_XMODEM_SEND_H_
2 | #define APPLICATIONS_CHECK_AGENT_XMODEM_SEND_H_
3 | #include "microboot.h"
4 |
5 | typedef struct ymodem_send_t {
6 | ymodem_t parent;
7 | char chFileName[5][32];
8 | uint8_t chfileNum;
9 | peek_byte_t *ptReadByte;
10 | uint32_t wFileSize;
11 | uint32_t wOffSet;
12 | SIG_SLOT_OBJ;
13 | } ymodem_send_t;
14 |
15 | typedef struct ymodem_lib_send_t {
16 | check_agent_t tCheckAgent;
17 | ymodem_send_t tYmodemSent;
18 | } ymodem_lib_send_t;
19 |
20 | signals(ymodem_send_sig, ymodem_send_t *ptThis,
21 | args(
22 | uint8_t *pchByte,
23 | uint16_t hwLen
24 | ));
25 |
26 | ymodem_lib_send_t *ymodem_lib_send_init(ymodem_lib_send_t *ptObj, peek_byte_t *ptReadByte);
27 | #endif /* APPLICATIONS_CHECK_AGENT_XMODEM_H_ */
28 |
--------------------------------------------------------------------------------
/gen_pack.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 | # Version: 2.7
3 | # Date: 2023-05-22
4 | # This bash script generates a CMSIS Software Pack:
5 | #
6 |
7 | set -o pipefail
8 |
9 | # Set version of gen pack library
10 | # For available versions see https://github.com/Open-CMSIS-Pack/gen-pack/tags.
11 | # Use the tag name without the prefix "v", e.g., 0.7.0
12 | REQUIRED_GEN_PACK_LIB="0.8.4"
13 |
14 | # Set default command line arguments
15 | DEFAULT_ARGS=(-c "v")
16 |
17 | # Pack warehouse directory - destination
18 | # Default: ./output
19 | #
20 | # PACK_OUTPUT=./output
21 |
22 | # Temporary pack build directory,
23 | # Default: ./build
24 | #
25 | # PACK_BUILD=./build
26 |
27 | # Specify directory names to be added to pack base directory
28 | # An empty list defaults to all folders next to this script.
29 | # Default: empty (all folders)
30 | #
31 | #PACK_DIRS="
32 | #
33 | #"
34 |
35 | # Specify file names to be added to pack base directory
36 | # Default: empty
37 | #
38 | PACK_BASE_FILES="
39 | LICENSE
40 | README.md
41 | "
42 |
43 | # Specify file names to be deleted from pack build directory
44 | # Default: empty
45 | #
46 | # PACK_DELETE_FILES="
47 | # "
48 |
49 | # Specify patches to be applied
50 | # Default: empty
51 | #
52 | # PACK_PATCH_FILES="
53 | #
54 | # "
55 |
56 | # Specify addition argument to packchk
57 | # Default: empty
58 | #
59 | # PACKCHK_ARGS=()
60 |
61 | # Specify additional dependencies for packchk
62 | # Default: empty
63 | #
64 | # PACKCHK_DEPS="
65 | #
66 | # "
67 |
68 | # Optional: restrict fallback modes for changelog generation
69 | # Default: full
70 | # Values:
71 | # - full Tag annotations, release descriptions, or commit messages (in order)
72 | # - release Tag annotations, or release descriptions (in order)
73 | # - tag Tag annotations only
74 | #
75 | # PACK_CHANGELOG_MODE=""
76 |
77 | #
78 | # custom pre-processing steps
79 | #
80 | # usage: preprocess
81 | # The build folder
82 | #
83 | function preprocess() {
84 | # add custom steps here to be executed
85 | # before populating the pack build folder
86 | return 0
87 | }
88 |
89 | #
90 | # custom post-processing steps
91 | #
92 | # usage: postprocess
93 | # The build folder
94 | #
95 | function postprocess() {
96 | # add custom steps here to be executed
97 | # after populating the pack build folder
98 | # but before archiving the pack into output folder
99 | return 0
100 | }
101 |
102 | ############ DO NOT EDIT BELOW ###########
103 |
104 | function install_lib() {
105 | local URL="https://github.com/Open-CMSIS-Pack/gen-pack/archive/refs/tags/v$1.tar.gz"
106 | local STATUS=$(curl -sLI "${URL}" | grep "^HTTP" | tail -n 1 | cut -d' ' -f2 || echo "$((600+$?))")
107 | if [[ $STATUS -ge 400 ]]; then
108 | echo "Wrong/unavailable gen-pack lib version '$1'!" >&2
109 | echo "Check REQUIRED_GEN_PACK_LIB variable." >&2
110 | echo "For available versions see https://github.com/Open-CMSIS-Pack/gen-pack/tags." >&2
111 | exit 1
112 | fi
113 | echo "Downloading gen-pack lib version '$1' to '$2' ..."
114 | mkdir -p "$2"
115 | curl -L "${URL}" -s | tar -xzf - --strip-components 1 -C "$2" || exit 1
116 | }
117 |
118 | function load_lib() {
119 | if [[ -d ${GEN_PACK_LIB} ]]; then
120 | . "${GEN_PACK_LIB}/gen-pack"
121 | return 0
122 | fi
123 | local GLOBAL_LIB="/usr/local/share/gen-pack/${REQUIRED_GEN_PACK_LIB}"
124 | local USER_LIB="${HOME}/.local/share/gen-pack/${REQUIRED_GEN_PACK_LIB}"
125 | if [[ ! -d "${GLOBAL_LIB}" && ! -d "${USER_LIB}" ]]; then
126 | echo "Required gen_pack lib not found!" >&2
127 | install_lib "${REQUIRED_GEN_PACK_LIB}" "${USER_LIB}"
128 | fi
129 |
130 | if [[ -d "${GLOBAL_LIB}" ]]; then
131 | . "${GLOBAL_LIB}/gen-pack"
132 | elif [[ -d "${USER_LIB}" ]]; then
133 | . "${USER_LIB}/gen-pack"
134 | else
135 | echo "Required gen-pack lib is not installed!" >&2
136 | exit 1
137 | fi
138 | }
139 |
140 | load_lib
141 | gen_pack "${DEFAULT_ARGS[@]}" "$@"
142 |
143 | exit 0
--------------------------------------------------------------------------------
/mkdocs.yml:
--------------------------------------------------------------------------------
1 | # 站点信息
2 | site_name: MicroBoot # 文档站点名称
3 | site_description: A sample documentation site # 文档站点描述
4 | site_author: kk # 文档作者
5 |
6 | # 导航栏
7 | nav:
8 | - 简介: index.md
9 | - 快速移植:
10 | - 基于 CMSIS-PACK 移植 : quick-start/cmsis-pack.md
11 | - 基于 RT-Thread 软件包移植 : quick-start/RT-Thread.md
12 | - 基于源码移植: quick-start/quick-start.md
13 | - 移植常见问题: quick-start/troubleshooting.md
14 | - 使用指南:
15 | - 配置: usage-guide/config.md
16 | - 必备知识:
17 | - 变参函数和可变参数宏: utilities/ParameterMacro.md
18 | - Flash下载算法制作: utilities/FLM.md
19 | - 组件介绍:
20 | - queue: components/queue/queue.md
21 | - 信号槽: components/signals_slots/signals_slots.md
22 | - 发布订阅: components/subscribe_publish/subscribe_publish.md
23 | - 消息地图: components/msg_map/msg_map.md
24 | - shell: components/shell/shell.md
25 | - ymodem: components/ymodem/ymodem.md
26 | - BootLoader: components/bootloader/bootloader.md
27 | - FlashBlob: components/flash_blob/flash_blob.md
28 | - 第三方库:
29 | - Arm-2D: 3rd-party/Arm-2D/arm_2d.md
30 | - PLOOC: 3rd-party/plooc/plooc.md
31 | - FSM: 3rd-party/fsm/fsm.md
32 | - 开发神器:
33 | - 简介: tools/microlink/microlink.md
34 | - RTT: tools/microlink/RTT_printf.md
35 | - SystemView: tools/microlink/SystemView.md
36 | - 脱机下载: tools/microlink/offline_download.md
37 | - Python API: tools/microlink/python_api.md
38 | - 参与项目:
39 | - 如何贡献代码: contribute/code.md
40 | - 如何贡献文档: contribute/document.md
41 | - 私人订制:
42 | - BootLoader: bootloader/BootLoader.md
43 | - About:
44 | - Overview: about/about.md
45 | - Team: about/team.md
46 |
47 | # 主题配置
48 | theme:
49 | name: material # 使用 Material 主题
50 | features:
51 | - navigation.tabs # 启用选项卡导航
52 | - navigation.indexes # 启用索引导航
53 | palette:
54 | scheme: default
55 | primary: indigo
56 | accent: indigo
57 |
58 | extra_css:
59 | - css/custom.css
60 |
61 | extra_javascript:
62 | - https://fonts.googleapis.com/css?family=Fira+Code&display=swap
63 |
64 | plugins:
65 | - search
66 | - awesome-pages
67 |
68 | markdown_extensions:
69 | - toc:
70 | permalink: true
71 | - tables
72 | - footnotes
73 | - def_list
74 | - admonition
75 | - codehilite:
76 | linenums: true
77 | - pymdownx.superfences
78 | - pymdownx.inlinehilite
79 | - pymdownx.magiclink
80 | - pymdownx.critic
81 | - pymdownx.tasklist:
82 | custom_checkbox: true
83 |
84 | # GitHub 仓库配置
85 | repo_name: Aladdin-Wang/MicroBoot # GitHub 用户名和仓库名称
86 | repo_url: https://github.com/Aladdin-Wang/MicroBoot # GitHub 仓库的 URL
87 | edit_uri: "" # 如果您的文档在仓库的根目录,可以留空
88 |
89 |
90 |
--------------------------------------------------------------------------------
/source/IPC/critical/critical.c:
--------------------------------------------------------------------------------
1 | #include "critical.h"
2 |
3 | bool enter_critical_sector(mutex_t *ptMutex)
4 | {
5 | assert(NULL != ptMutex);
6 |
7 | if(ptMutex->bLocked == false){
8 | ptMutex->bLocked = true;
9 | return true;
10 | }
11 |
12 | return false;
13 | }
14 |
15 | void leave_critical_sector(mutex_t *ptMutex)
16 | {
17 | assert(NULL != ptMutex);
18 |
19 | ptMutex->bLocked = false;
20 | }
21 |
22 | void init_critical_sector(mutex_t *ptMutex)
23 | {
24 | assert(NULL != ptMutex);
25 |
26 | ptMutex->bLocked = false;
27 | }
28 |
29 |
--------------------------------------------------------------------------------
/source/IPC/critical/critical.h:
--------------------------------------------------------------------------------
1 | #ifndef __CRITICAL_SECTOR_H
2 | #define __CRITICAL_SECTOR_H
3 | #include
4 | #include
5 | #include
6 |
7 | #ifdef __cplusplus
8 | extern "C" {
9 | #endif
10 |
11 | typedef struct {
12 | bool bLocked;
13 | }critical_sector_t;
14 | typedef critical_sector_t mutex_t;
15 |
16 | #define ENTER_CRITICAL_SECTOR(__CRITICAL) enter_critical_sector(__CRITICAL)
17 | #define LEAVE_CRITICAL_SECTOR(__CRITICAL) leave_critical_sector(__CRITICAL)
18 | #define INIT_CRITICAL_SECTOR(__CRITICAL) init_critical_sector(__CRITICAL)
19 |
20 | extern bool enter_critical_sector(mutex_t *ptMutex);
21 | extern void leave_critical_sector(mutex_t *ptMutex);
22 | extern void init_critical_sector(mutex_t *ptMutex);
23 |
24 | #ifdef __cplusplus
25 | }
26 | #endif
27 |
28 | #endif
29 |
--------------------------------------------------------------------------------
/source/IPC/event/app_cfg.h:
--------------------------------------------------------------------------------
1 | //! \note do not move this pre-processor statement to other places
2 | #include "..\app_cfg.h"
3 |
4 | #ifndef __EVENT_APP_CFG_H__
5 | #define __EVENT_APP_CFG_H__
6 |
7 | /*============================ INCLUDES ======================================*/
8 | /*============================ MACROS ========================================*/
9 | /*============================ MACROFIED FUNCTIONS ===========================*/
10 | /*============================ TYPES =========================================*/
11 | /*============================ GLOBAL VARIABLES ==============================*/
12 | /*============================ LOCAL VARIABLES ===============================*/
13 | /*============================ PROTOTYPES ====================================*/
14 |
15 |
16 | #endif
17 | /* EOF */
18 |
19 |
--------------------------------------------------------------------------------
/source/IPC/event/event.c:
--------------------------------------------------------------------------------
1 | #include "event.h"
2 |
3 | void set_event(event_t *ptEvent)
4 | {
5 | assert(NULL != ptEvent);
6 |
7 | ptEvent->bIsSet = true;
8 | }
9 |
10 | void reset_event(event_t *ptEvent)
11 | {
12 | assert(NULL != ptEvent);
13 |
14 | ptEvent->bIsSet = false;
15 | }
16 |
17 | bool wait_event(event_t *ptEvent)
18 | {
19 | assert(NULL != ptEvent);
20 |
21 | if(ptEvent->bIsSet != false){
22 | if(ptEvent->bAutoReset != false){
23 | reset_event (ptEvent);
24 | }
25 | return true;
26 | }
27 | return false;
28 | }
29 |
30 | void init_enent(event_t *ptEvent,bool bInitValue,bool bManual)
31 | {
32 | assert(NULL != ptEvent);
33 |
34 | ptEvent->bIsSet = bInitValue;
35 | ptEvent->bAutoReset = !bManual;
36 | }
37 |
38 |
--------------------------------------------------------------------------------
/source/IPC/event/event.h:
--------------------------------------------------------------------------------
1 | #ifndef __EVENT_H
2 | #define __EVENT_H
3 | #include ".\app_cfg.h"
4 | #include
5 | #include
6 | #include
7 |
8 | #ifdef __cplusplus
9 | extern "C" {
10 | #endif
11 |
12 | typedef struct {
13 | bool bAutoReset;
14 | bool bIsSet;
15 | }event_t;
16 |
17 | #define INIT_EVENT(__EVENT, __INIT_VALUE,__MANUAL) init_enent(__EVENT, __INIT_VALUE,__MANUAL)
18 | #define SET_EVENT(__EVENT) set_event(__EVENT)
19 | #define RESET_EVENT(__EVENT) reset_event(__EVENT)
20 | #define WAIT_EVENT(__EVENT) wait_event(__EVENT)
21 |
22 | extern void init_enent(event_t *ptEvent,bool bInitValue,bool bManual);
23 | extern void reset_event(event_t *ptEvent);
24 | extern bool wait_event(event_t *ptEvent);
25 | extern void set_event(event_t *ptEvent);
26 |
27 | #ifdef __cplusplus
28 | }
29 | #endif
30 |
31 | #endif
32 |
--------------------------------------------------------------------------------
/source/app_cfg.h:
--------------------------------------------------------------------------------
1 | /* WALI Serve config file */
2 |
3 | #ifndef __WL_SERVE_CFG_H__
4 | #define __WL_SERVE_CFG_H__
5 |
6 | #ifdef __USER_APP_CFG_H__
7 | #include __USER_APP_CFG_H__
8 | #else
9 | // <<< Use Configuration Wizard in Context Menu >>>
10 |
11 | // Log Configuration
12 | // enable kernel debug configuration
13 | // Default: enable kernel debug configuration
14 | //#define RT_DEBUG
15 | //
16 | // enable components initialization debug configuration<0-1>
17 | // Default: 0
18 | #define RT_DEBUG_INIT 0
19 | // thread stack over flow detect
20 | // Diable Thread stack over flow detect
21 | //#define RT_USING_OVERFLOW_CHECK
22 | //
23 | //
24 | // Msg Map Configuration
25 | // Enables msg_map
26 | #define USING_MSG_MAP 1
27 | #if USING_MSG_MAP == 0
28 | #undef USING_MSG_MAP
29 | #endif
30 | // The maximum length of parameters <0-128>
31 | // Default: 128
32 | #define MSG_ARG_LEN 128
33 | // The maximum number of parameters <0-16>
34 | // Default: 8
35 | #define MSG_ARG_MAX 8
36 | //
37 |
38 | // Flash BLOB Configuration
39 | // Flash BLOB Management
40 | // Flash BLOB Management
41 | #define USING_FLASH_BLOB
42 | //
43 | //
44 |
45 | // Check Use Peek
46 | // check use peek engine
47 | // check use peek engine
48 | #define USING_CHECK_ENGINE
49 | //
50 | //
51 |
52 | // Shell Configuration
53 | // Enables shell
54 | #define USING_SHELL 1
55 | #if USING_SHELL == 0
56 | #undef WL_USING_SHELL
57 | #endif
58 | // Use echo mode
59 | // FINSH_OPTION_ECHO=0x01 is echo mode, other values are none-echo mode.
60 | #define SHELL_OPTION_ECHO 1
61 | // The maximum number of history lines <0-16>
62 | // Default: 8
63 | #define SHELL_HISTORY_LINES 5
64 | //
65 | // IPC(Inter-process communication) Configuration
66 | // Using Ring Queue
67 | // Using Ring Queue
68 | #define USING_RINGEQUEUE
69 | //
70 | // Using Signals-Slots
71 | // Using Signals-Slots
72 | #define USING_SIGNALS_SLOTS
73 | //
74 | // Using Subscribe-Publish
75 | // Using Subscribe-Publish
76 | #define USING_SUBSCRIBE_PUBLISH
77 | //
78 | // Using Event
79 | // Using Event
80 | //#define WL_USING_EVENT
81 | //
82 | // Using MailBox
83 | // Using MailBox
84 | //#define WL_USING_MAILBOX
85 | //
86 | //
87 | // Memory Management Configuration
88 | // Memory Pool Management
89 | // Memory Pool Management
90 | //#define RT_USING_MEMPOOL
91 | //
92 | //
93 | // BootLoader Configuration
94 | // Enables BootLoader
95 | #define USING_BOOT 1
96 | #if USING_BOOT == 0
97 | #undef USING_BOOT
98 | #endif
99 | // The starting address of the app
100 | // Default: 0x8020000
101 | // Must align with flash sector size
102 | #define APP_PART_ADDR 0x8020000
103 | // The reset vector offset in the application
104 | // Default: 0x4
105 | // The offset of the reset vector from the application start
106 | #define APP_PART_OFFSET 0x4
107 | // The app size
108 | // Default: 0X60000
109 | // Must align with flash sector size
110 | #define APP_PART_SIZE 0x60000
111 | // The Boot Flash Ops Addr
112 | // Default: 0x08001000
113 | // Must align with flash sector size
114 | #define BOOT_FLASH_OPS_ADDR 0x08001000
115 | //
116 |
117 | // <<< end of configuration section >>>
118 | #endif
119 | #endif
120 |
--------------------------------------------------------------------------------
/source/bootloader/app_cfg.h:
--------------------------------------------------------------------------------
1 | //! \note do not move this pre-processor statement to other places
2 | #include "../app_cfg.h"
3 |
4 | #ifndef __BOOTLOADER_CFG_H__
5 | #define __BOOTLOADER_CFG_H__
6 |
7 | /*============================ INCLUDES ======================================*/
8 | /*============================ MACROS ========================================*/
9 | /*============================ MACROFIED FUNCTIONS ===========================*/
10 | /*============================ TYPES =========================================*/
11 | /*============================ GLOBAL VARIABLES ==============================*/
12 | /*============================ LOCAL VARIABLES ===============================*/
13 | /*============================ PROTOTYPES ====================================*/
14 |
15 |
16 | #endif
17 | /* EOF */
18 |
19 |
--------------------------------------------------------------------------------
/source/bootloader/bootloader.h:
--------------------------------------------------------------------------------
1 | #ifndef BOOTLOADER_H_
2 | #define BOOTLOADER_H_
3 | #include ".\app_cfg.h"
4 | #include
5 | #include
6 | #include "../flash_algo/flash_algo.h"
7 | // The user data size
8 | // Default: 192
9 | #define USER_DATA_SIZE 192
10 |
11 | typedef struct {
12 | char chProjectName[16];
13 | char chHardWareVersion[16];
14 | char chSoftBootVersion[16];
15 | char chSoftAppVersion[16];
16 | char chReceive[128];
17 | } msgSig_t;
18 | typedef struct {
19 | union {
20 | msgSig_t sig;
21 | uint8_t B[USER_DATA_SIZE];
22 | } msg_data;
23 | } user_data_t;
24 |
25 | extern user_data_t tUserData;
26 | extern void enter_bootloader(uint8_t *pchDate, uint16_t hwLength);
27 | extern void begin_download(void);
28 | extern void finalize_download(void);
29 |
30 | #endif
31 |
32 |
33 |
--------------------------------------------------------------------------------
/source/check_agent_engine/app_cfg.h:
--------------------------------------------------------------------------------
1 | //! \note do not move this pre-processor statement to other places
2 | #include "../app_cfg.h"
3 |
4 | #ifndef __CHECK_USE_PEEK_APP_CFG_H__
5 | #define __CHECK_USE_PEEK_APP_CFG_H__
6 |
7 | /*============================ INCLUDES ======================================*/
8 | /*============================ MACROS ========================================*/
9 | /*============================ MACROFIED FUNCTIONS ===========================*/
10 | /*============================ TYPES =========================================*/
11 | /*============================ GLOBAL VARIABLES ==============================*/
12 | /*============================ LOCAL VARIABLES ===============================*/
13 | /*============================ PROTOTYPES ====================================*/
14 |
15 |
16 | #endif
17 | /* EOF */
18 |
19 |
--------------------------------------------------------------------------------
/source/check_agent_engine/check_agent_engine.h:
--------------------------------------------------------------------------------
1 | /****************************************************************************
2 | * Copyright 2022 kk (https://github.com/Aladdin-Wang) *
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 |
18 | #ifndef __SERVE_CHECK_AGENT_ENGINE_H_
19 | #define __SERVE_CHECK_AGENT_ENGINE_H_
20 | #include "./app_cfg.h"
21 | #if USE_SERVICE_CHECK_USE_PEEK == ENABLED
22 | #include "../generic/queue/ring_queue.h"
23 | #include "../fsm/simple_fsm.h"
24 |
25 | #ifdef __cplusplus
26 | extern "C" {
27 | #endif
28 |
29 | typedef struct _peek_byte_t peek_byte_t;
30 | typedef uint16_t peek_byte_hanlder_t(peek_byte_t *ptThis,uint8_t *pchByte, uint16_t hwLength);
31 | struct _peek_byte_t{
32 | void *pTarget;
33 | peek_byte_hanlder_t *fnGetByte;
34 | };
35 |
36 | typedef struct _check_agent_t check_agent_t;
37 | typedef fsm_rt_t check_hanlder_t(void *ptThis);
38 | struct _check_agent_t{
39 | check_agent_t *ptNext;
40 | check_hanlder_t *fnCheck;
41 | void * pAgent;
42 | uint16_t hwPeekStatus;
43 | bool bIsKeepingContext;
44 | };
45 |
46 | declare_simple_fsm(check_use_peek);
47 | extern_fsm_implementation(check_use_peek);
48 | extern_fsm_initialiser( check_use_peek,
49 | args(
50 | byte_queue_t *ptByteInQueue
51 | ))
52 |
53 | extern_simple_fsm(check_use_peek,
54 | def_params(
55 | check_agent_t *ptFreeList;
56 | check_agent_t *ptCheckList;
57 | byte_queue_t *ptByteInQueue;
58 | peek_byte_t tPeekByte;
59 | bool bIsRequestDrop;
60 | uint8_t chByte;
61 | )
62 | )
63 | extern peek_byte_t *get_read_byte_interface(fsm_check_use_peek_t *ptObj);
64 | extern bool agent_register(fsm_check_use_peek_t *ptObj,check_agent_t *ptNewItem);
65 | extern bool agent_unregister(fsm_check_use_peek_t *ptObj,check_agent_t *ptNote);
66 |
67 | #ifdef __cplusplus
68 | }
69 | #endif
70 |
71 | #endif
72 | #endif /* APPLICATIONS_CHECK_USE_PEEK_H_ */
73 |
--------------------------------------------------------------------------------
/source/communication/app_cfg.h:
--------------------------------------------------------------------------------
1 | //! \note do not move this pre-processor statement to other places
2 | #include "../app_cfg.h"
3 |
4 | #ifndef __COMMUNICATION_CFG_H__
5 | #define __COMMUNICATION_CFG_H__
6 |
7 | /*============================ INCLUDES ======================================*/
8 | /*============================ MACROS ========================================*/
9 | /*============================ MACROFIED FUNCTIONS ===========================*/
10 | /*============================ TYPES =========================================*/
11 | /*============================ GLOBAL VARIABLES ==============================*/
12 | /*============================ LOCAL VARIABLES ===============================*/
13 | /*============================ PROTOTYPES ====================================*/
14 |
15 |
16 | #endif
17 | /* EOF */
18 |
19 |
--------------------------------------------------------------------------------
/source/communication/frame/simple_frame.c:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aladdin-Wang/MicroBoot/2f802e24538da61bdd53ca84dad730084afaca03/source/communication/frame/simple_frame.c
--------------------------------------------------------------------------------
/source/communication/frame/simple_frame.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aladdin-Wang/MicroBoot/2f802e24538da61bdd53ca84dad730084afaca03/source/communication/frame/simple_frame.h
--------------------------------------------------------------------------------
/source/communication/msg_map/app_cfg.h:
--------------------------------------------------------------------------------
1 | //! \note do not move this pre-processor statement to other places
2 | #include "..\app_cfg.h"
3 |
4 | #ifndef __CHECK_STR_APP_CFG_H__
5 | #define __CHECK_STR_APP_CFG_H__
6 |
7 | /*============================ INCLUDES ======================================*/
8 | /*============================ MACROS ========================================*/
9 | /*============================ MACROFIED FUNCTIONS ===========================*/
10 | /*============================ TYPES =========================================*/
11 | /*============================ GLOBAL VARIABLES ==============================*/
12 | /*============================ LOCAL VARIABLES ===============================*/
13 | /*============================ PROTOTYPES ====================================*/
14 |
15 | #endif
16 | /* EOF */
17 |
18 |
--------------------------------------------------------------------------------
/source/communication/msg_map/msg_check_arg.c:
--------------------------------------------------------------------------------
1 | /****************************************************************************
2 | * Copyright 2022 kk (https://github.com/Aladdin-Wang) *
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 |
18 | #include "msg_check_arg.h"
19 | #if defined(USING_MSG_MAP)
20 | #include
21 | def_simple_fsm( check_arg,
22 | def_params(
23 | const char *pchStr;
24 | uint16_t hwIndex;
25 | int16_t hwCount;
26 | uint8_t chByte;
27 | bool bArgIsString;
28 | get_byte_t *ptGetByte;
29 | uint8_t chArgNums;
30 | int16_t chArgLen;
31 | char chArgs[MSG_ARG_LEN];
32 | int32_t *argc;
33 | char **argv;
34 | )
35 | )
36 |
37 | fsm_initialiser( check_arg,
38 | args(
39 | const char *pchString,
40 | get_byte_t *ptGetByte,
41 | int32_t *argc,
42 | char **argv,
43 | bool bArgIsString
44 | ))
45 |
46 | init_body (
47 | if (NULL == pchString || NULL == ptGetByte || NULL == argc || NULL == argv ) {
48 | abort_init();
49 | }
50 | this.pchStr = pchString;
51 | this.ptGetByte = ptGetByte;
52 | this.hwCount = 0;
53 | this.hwIndex = 0;
54 | this.bArgIsString = bArgIsString;
55 | this.argc = argc;
56 | this.argv = argv;
57 | )
58 |
59 | fsm_implementation( check_arg )
60 | {
61 | def_states(IS_END_OF_ARG,IS_START_OF_ARG,RECEIVE_ARG)
62 |
63 | body_begin();
64 |
65 | on_start(
66 | this.hwIndex = 0;
67 | memset(this.chArgs,0,sizeof(this.chArgs));
68 | this.argv[0] = (char *)this.pchStr;
69 | *(this.argc) = 1;
70 | update_state_to(IS_START_OF_ARG);
71 | )
72 |
73 | state(IS_START_OF_ARG) {
74 | if(this.bArgIsString == false){
75 | if(this.ptGetByte->fnGetByte(this.ptGetByte,&(this.chByte),1)) {
76 | if(this.chByte > 0){
77 | this.chArgNums = this.chByte;
78 | update_state_to(RECEIVE_ARG);
79 | }else{
80 | fsm_cpl();
81 | }
82 | fsm_user_req_drop();
83 | }
84 | reset_fsm();
85 | }else{
86 | if(this.ptGetByte->fnGetByte(this.ptGetByte,&(this.chByte),1)) {
87 | if(this.chByte == ' '){
88 | update_state_to(RECEIVE_ARG);
89 | }else if(this.chByte == '\r' || this.chByte == '\n') {
90 | fsm_cpl();
91 | }
92 | fsm_user_req_drop();
93 | }
94 | reset_fsm();
95 | }
96 | }
97 |
98 | state(RECEIVE_ARG) {
99 | if(this.bArgIsString == false){
100 | if(this.ptGetByte->fnGetByte(this.ptGetByte,(uint8_t *)&(this.chArgLen),sizeof(this.chArgLen))) {
101 | if(this.ptGetByte->fnGetByte(this.ptGetByte,(uint8_t *)&(this.chArgs[this.hwIndex]),this.chArgLen)) {
102 | this.argv[(*this.argc)++] = &this.chArgs[this.hwIndex];
103 | this.hwIndex += this.chArgLen;
104 | update_state_to(IS_END_OF_ARG);
105 | }
106 | }
107 | reset_fsm();
108 | }else{
109 | if(this.ptGetByte->fnGetByte(this.ptGetByte,&(this.chByte),1)) {
110 | if(this.chByte == ' '){
111 | this.chByte = '\0';
112 | this.argv[(*this.argc)++] = &this.chArgs[this.hwIndex - this.hwCount];
113 | this.hwCount = -1;
114 | }
115 | this.chArgs[this.hwIndex++] = this.chByte;
116 | this.hwCount++;
117 | update_state_to(IS_END_OF_ARG);
118 | }
119 | reset_fsm();
120 | }
121 | }
122 |
123 | state(IS_END_OF_ARG) {
124 | if(this.bArgIsString == false){
125 | if((*this.argc) > this.chArgNums || this.hwIndex >= MSG_ARG_LEN - 1){
126 | fsm_cpl();
127 | }
128 | update_state_to(RECEIVE_ARG);
129 | }else{
130 | if(this.chByte == '\r' || this.chByte == '\n' || this.hwIndex >= MSG_ARG_LEN - 1) {
131 | this.chByte = '\0';
132 | this.argv[(*this.argc)++] = &this.chArgs[this.hwIndex - this.hwCount];
133 | this.chArgs[--this.hwIndex] = this.chByte;
134 | fsm_cpl();
135 | }
136 | update_state_to(RECEIVE_ARG);
137 | }
138 | }
139 | body_end();
140 | }
141 | #endif
142 |
--------------------------------------------------------------------------------
/source/communication/msg_map/msg_check_arg.h:
--------------------------------------------------------------------------------
1 | /****************************************************************************
2 | * Copyright 2022 kk (https://github.com/Aladdin-Wang) *
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 |
18 | #ifndef __SERVE_MSG_CHECK_ARG_H_
19 | #define __SERVE_MSG_CHECK_ARG_H_
20 | #include "./app_cfg.h"
21 | #if defined(USING_MSG_MAP)
22 | #include "../.././fsm/simple_fsm.h"
23 | #include "msg_get_byte.h"
24 | #ifdef __cplusplus
25 | extern "C" {
26 | #endif
27 | declare_simple_fsm(check_arg);
28 | extern_fsm_implementation(check_arg);
29 | extern_fsm_initialiser( check_arg,
30 | args(
31 | const char *pchString,
32 | get_byte_t *ptGetByte,
33 | int32_t *argc,
34 | char **argv,
35 | bool bArgIsString
36 | ))
37 | /*! fsm used to output specified string */
38 | extern_simple_fsm(check_arg,
39 | def_params(
40 | const char *pchStr;
41 | uint16_t hwIndex;
42 | int16_t hwCount;
43 | uint8_t chByte;
44 | bool bArgIsString;
45 | get_byte_t *ptGetByte;
46 | uint8_t chArgNums;
47 | int16_t chArgLen;
48 | char chArgs[MSG_ARG_LEN];
49 | int32_t *argc;
50 | char **argv;
51 | )
52 | )
53 |
54 | #ifdef __cplusplus
55 | }
56 | #endif
57 | #endif
58 | #endif
59 |
--------------------------------------------------------------------------------
/source/communication/msg_map/msg_check_str.c:
--------------------------------------------------------------------------------
1 | /****************************************************************************
2 | * Copyright 2022 kk (https://github.com/Aladdin-Wang) *
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 |
18 | #include "msg_check_str.h"
19 | #if defined(USING_MSG_MAP)
20 | def_simple_fsm( check_string,
21 | def_params(
22 | const char *pchStr;
23 | uint16_t hwIndex;
24 | uint8_t chByte;
25 | get_byte_t *ptGetByte;
26 | )
27 | )
28 |
29 | fsm_initialiser( check_string,
30 | args(
31 | const char *pchString,
32 | get_byte_t *ptGetByte
33 | ))
34 |
35 | init_body (
36 | if (NULL == pchString || NULL == ptGetByte ) {
37 | abort_init();
38 | }
39 | this.pchStr = pchString;
40 | this.ptGetByte = ptGetByte;
41 | )
42 |
43 | fsm_implementation( check_string )
44 | {
45 | def_states( IS_END_OF_STR, INPUT_CHAR,IS_TIMEOUT)
46 |
47 | body_begin();
48 |
49 | on_start(
50 | this.hwIndex = 0;
51 | update_state_to(IS_END_OF_STR);
52 | )
53 |
54 | state(IS_END_OF_STR) {
55 | if(this.pchStr[this.hwIndex] == '\0') {
56 | fsm_cpl();
57 | }
58 | update_state_to(INPUT_CHAR);
59 | }
60 |
61 | state(INPUT_CHAR) {
62 | if(this.ptGetByte->fnGetByte(this.ptGetByte,&(this.chByte),1)) {
63 | if(this.chByte != this.pchStr[this.hwIndex++]){
64 | fsm_user_req_drop();
65 | }
66 | update_state_to(IS_END_OF_STR);
67 | }
68 | reset_fsm();
69 | }
70 |
71 | body_end();
72 | }
73 |
74 | #endif
75 |
76 |
77 |
--------------------------------------------------------------------------------
/source/communication/msg_map/msg_check_str.h:
--------------------------------------------------------------------------------
1 | /****************************************************************************
2 | * Copyright 2022 kk (https://github.com/Aladdin-Wang) *
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 |
18 | #ifndef __SERVE_MSG_CHECK_STR_H_
19 | #define __SERVE_MSG_CHECK_STR_H_
20 | #include "./app_cfg.h"
21 | #if defined(USING_MSG_MAP)
22 | #include "../.././fsm/simple_fsm.h"
23 | #include "msg_get_byte.h"
24 | #include
25 | #ifdef __cplusplus
26 | extern "C" {
27 | #endif
28 | declare_simple_fsm(check_string);
29 | extern_fsm_implementation(check_string);
30 | extern_fsm_initialiser( check_string,
31 | args(
32 | const char *pchString,
33 | get_byte_t *ptGetByte
34 | ))
35 | /*! fsm used to output specified string */
36 | extern_simple_fsm(check_string,
37 | def_params(
38 | const char *pchStr;
39 | uint16_t hwIndex;
40 | uint8_t chByte;
41 | get_byte_t *ptGetByte;
42 | )
43 | )
44 |
45 | #ifdef __cplusplus
46 | }
47 | #endif
48 | #endif
49 | #endif
50 |
--------------------------------------------------------------------------------
/source/communication/msg_map/msg_get_byte.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2006-2021, RT-Thread Development Team
3 | *
4 | * SPDX-License-Identifier: Apache-2.0
5 | *
6 | * Change Logs:
7 | * Date Author Notes
8 | * 2021-09-21 Administrator the first version
9 | */
10 | #ifndef CHECK_STR_GET_BYTE_H_
11 | #define CHECK_STR_GET_BYTE_H_
12 | typedef struct _get_byte_t get_byte_t;
13 | typedef uint16_t get_byte_hanlder_t(get_byte_t *ptThis,uint8_t *pchByte, uint16_t hwLength);
14 | struct _get_byte_t{
15 | void *pTarget;
16 | get_byte_hanlder_t *fnGetByte;
17 | };
18 |
19 | #endif /* CHECK_STR_GET_BYTE_H_ */
20 |
--------------------------------------------------------------------------------
/source/communication/msg_map/msg_map.c:
--------------------------------------------------------------------------------
1 | /****************************************************************************
2 | * Copyright 2022 kk (https://github.com/Aladdin-Wang) *
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 |
18 | #include "msg_map.h"
19 | #if defined(USING_MSG_MAP)
20 | #include
21 |
22 | def_simple_fsm( search_msg_map,
23 | def_params(
24 | fsm(check_string) fsmCheckStr;
25 | fsm(check_arg) fsmCheckArg;
26 | msg_t *ptMsgTableBase;
27 | msg_t *ptMsgTableLimit;
28 | get_byte_t *ptGetByte;
29 | uint8_t chByte;
30 | uint16_t hwIndex;
31 | bool bArgIsString;
32 | bool bIsRequestDrop;
33 | char *argv[MSG_ARG_MAX];
34 | int argc;
35 | )
36 | )
37 |
38 | fsm_initialiser(search_msg_map,
39 | args(
40 | msg_t *ptMsgTableBase,
41 | msg_t *ptMsgTableLimit,
42 | get_byte_t *ptGetByte,
43 | bool bArgIsString
44 | ))
45 |
46 | init_body (
47 |
48 | if (NULL == ptGetByte || NULL == ptMsgTableBase || NULL == ptMsgTableLimit)
49 | {
50 | abort_init();
51 | }
52 | this.ptMsgTableBase = ptMsgTableBase;
53 | this.ptMsgTableLimit = ptMsgTableLimit;
54 | this.ptGetByte = ptGetByte;
55 | this.bArgIsString = bArgIsString;
56 | )
57 |
58 | fsm_implementation(search_msg_map)
59 | {
60 | def_states( IS_END_OF_MSG, MSG, ARG)
61 |
62 | body_begin();
63 |
64 | on_start(
65 | this.bIsRequestDrop = true;
66 | this.hwIndex = 0;
67 | update_state_to(IS_END_OF_MSG);
68 | )
69 |
70 | state(IS_END_OF_MSG) {
71 | if(&this.ptMsgTableBase[this.hwIndex] == this.ptMsgTableLimit) {
72 | if(this.bIsRequestDrop != false) {
73 | fsm_user_req_drop();
74 | }
75 | reset_fsm();
76 | } else {
77 | init_fsm(check_string, &(this.fsmCheckStr), args((const char *)(this.ptMsgTableBase[this.hwIndex].pchMessage), this.ptGetByte));
78 | transfer_to(MSG);
79 | }
80 | }
81 |
82 | state(MSG) {
83 | fsm_rt_t tFsm = call_fsm( check_string, &(this.fsmCheckStr));
84 |
85 | if(fsm_rt_cpl == tFsm) {
86 | memset(this.argv, 0, sizeof(this.argv));
87 | init_fsm(check_arg, &(this.fsmCheckArg), args((const char *)(this.ptMsgTableBase[this.hwIndex].pchMessage),
88 | this.ptGetByte, &this.argc, this.argv, this.bArgIsString));
89 | update_state_to(ARG);
90 | }
91 |
92 | if(fsm_rt_user_req_drop == tFsm) {
93 | this.hwIndex++;
94 | update_state_to(IS_END_OF_MSG);
95 | }
96 |
97 | if(fsm_rt_on_going == tFsm) {
98 | this.bIsRequestDrop = false;
99 | this.hwIndex++;
100 | update_state_to(IS_END_OF_MSG);
101 | }
102 | }
103 |
104 | state(ARG) {
105 | fsm_rt_t tFsm = call_fsm( check_arg, &(this.fsmCheckArg));
106 |
107 | if(fsm_rt_cpl == tFsm) {
108 | this.ptMsgTableBase[this.hwIndex].fnHandler(this.argc, (void *)this.argv);
109 | fsm_cpl();
110 | }
111 |
112 | if(fsm_rt_user_req_drop == tFsm) {
113 | this.hwIndex++;
114 | update_state_to(IS_END_OF_MSG);
115 | }
116 |
117 | if(fsm_rt_on_going == tFsm) {
118 | this.hwIndex++;
119 | this.bIsRequestDrop = false;
120 | update_state_to(IS_END_OF_MSG);
121 | }
122 | }
123 | body_end();
124 | }
125 |
126 | #endif
--------------------------------------------------------------------------------
/source/communication/msg_map/msg_map.h:
--------------------------------------------------------------------------------
1 | /****************************************************************************
2 | * Copyright 2022 kk (https://github.com/Aladdin-Wang) *
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 |
18 | #ifndef __SERVE_MSG_MAP_H_
19 | #define __SERVE_MSG_MAP_H_
20 | #include "./app_cfg.h"
21 | #if defined(USING_MSG_MAP)
22 | #include "msg_check_str.h"
23 | #include "msg_check_arg.h"
24 |
25 | #ifdef __cplusplus
26 | extern "C" {
27 | #endif
28 |
29 | #define __section(x) __attribute__((section(x)))
30 | #define __used __attribute__((used))
31 |
32 | #define IS_FUNCTION_POINTER(name) \
33 | __builtin_types_compatible_p(typeof(name), typeof(msg_hanlder_t))
34 |
35 | #define COMPILER_CONCAT_(a, b) a##b
36 | #define COMPILER_CONCAT(a, b) COMPILER_CONCAT_(a, b)
37 |
38 | // Divide by zero if the the expression is false. This
39 | // causes an error at compile time.
40 | //
41 | // The special value '__COUNTER__' is used to create a unique value to
42 | // append to 'compiler_assert_' to create a unique token. This prevents
43 | // conflicts resulting from the same enum being declared multiple times.
44 | #define COMPILER_ASSERT(e) enum { COMPILER_CONCAT(compiler_assert_, __COUNTER__) = 1/((e) ? 1 : 0) }
45 |
46 | /********************************************************************************************/
47 | typedef struct _msg_t msg_t;
48 | typedef int msg_hanlder_t(int argc, char **argv);
49 | struct _msg_t{
50 | const char *pchMessage;
51 | msg_hanlder_t *fnHandler;
52 | const char *pchDesc;
53 | };
54 |
55 | declare_simple_fsm(search_msg_map);
56 | extern_fsm_implementation(search_msg_map);
57 | extern_fsm_initialiser( search_msg_map,
58 | args(
59 | msg_t *ptMsgTableBase,
60 | msg_t *ptMsgTableLimit,
61 | get_byte_t *ptGetByte,
62 | bool bArgIsString
63 | ))
64 | extern_simple_fsm(search_msg_map,
65 | def_params(
66 | fsm(check_string) fsmCheckStr;
67 | fsm(check_arg) fsmCheckArg;
68 | msg_t *ptMsgTableBase;
69 | msg_t *ptMsgTableLimit;
70 | get_byte_t *ptGetByte;
71 | uint8_t chByte;
72 | uint16_t hwIndex;
73 | bool bArgIsString;
74 | bool bIsRequestDrop;
75 | char *argv[MSG_ARG_MAX];
76 | int argc;
77 | )
78 | )
79 |
80 | #ifdef __cplusplus
81 | }
82 | #endif
83 | #endif
84 | #endif /* MSG_MAP_MSG_MAP_H_ */
85 |
86 |
87 |
--------------------------------------------------------------------------------
/source/communication/shell/app_cfg.h:
--------------------------------------------------------------------------------
1 | //! \note do not move this pre-processor statement to other places
2 | #include "..\app_cfg.h"
3 |
4 | #ifndef __WL_SHELL_CFG_H__
5 | #define __WL_SHELL_CFG_H__
6 |
7 | /*============================ INCLUDES ======================================*/
8 |
9 | /*============================ MACROS ========================================*/
10 |
11 | /*============================ MACROFIED FUNCTIONS ===========================*/
12 |
13 | /*============================ TYPES =========================================*/
14 |
15 | /*============================ GLOBAL VARIABLES ==============================*/
16 |
17 | /*============================ LOCAL VARIABLES ===============================*/
18 |
19 | /*============================ PROTOTYPES ====================================*/
20 |
21 | #endif
22 | /* EOF */
23 |
24 |
--------------------------------------------------------------------------------
/source/communication/shell/finsh.h:
--------------------------------------------------------------------------------
1 | #include "../msg_map/msg_map.h"
2 | /**
3 | * @ingroup msh
4 | *
5 | * This macro exports a command to module shell.
6 | *
7 | * @param command is the name of the command.
8 | * @param desc is the description of the command, which will show in help list.
9 | */
10 | #define MSH_FUNCTION_EXPORT_CMD(name, cmd, desc) \
11 | const char __fsym_##cmd##_name[] __section(".rodata.name") = #cmd; \
12 | const char __fsym_##cmd##_desc[] __section(".rodata.name") = #desc; \
13 | const __used struct _msg_t __fsym_##cmd __section("FSymTab")={ \
14 | __fsym_##cmd##_name, \
15 | (msg_hanlder_t *)&name, \
16 | __fsym_##cmd##_desc, \
17 | };
18 |
19 |
20 | #define MSH_CMD_EXPORT(command, desc) \
21 | MSH_FUNCTION_EXPORT_CMD(command, command, desc)
22 |
23 | /**
24 | * @ingroup msh
25 | *
26 | * This macro exports a command with alias to module shell.
27 | *
28 | * @param command is the name of the command.
29 | * @param alias is the alias of the command.
30 | * @param desc is the description of the command, which will show in help list.
31 | */
32 | #define MSH_CMD_EXPORT_ALIAS(command, alias, desc) \
33 | MSH_FUNCTION_EXPORT_CMD(command, alias, desc)
34 |
35 | /**
36 | * @ingroup finsh
37 | *
38 | * This macro exports a system function to finsh shell.
39 | *
40 | * @param name the name of function.
41 | * @param desc the description of function, which will show in help.
42 | */
43 | #define FINSH_FUNCTION_EXPORT(name, desc)
44 |
45 | /**
46 | * @ingroup finsh
47 | *
48 | * This macro exports a system function with an alias name to finsh shell.
49 | *
50 | * @param name the name of function.
51 | * @param alias the alias name of function.
52 | * @param desc the description of function, which will show in help.
53 | */
54 | #define FINSH_FUNCTION_EXPORT_ALIAS(name, alias, desc)
55 |
56 |
57 |
--------------------------------------------------------------------------------
/source/communication/shell/micro_shell.h:
--------------------------------------------------------------------------------
1 | /****************************************************************************
2 | * Copyright 2022 kk (https://github.com/Aladdin-Wang) *
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 |
18 | #ifndef __SERVE_SHELL_H_
19 | #define __SERVE_SHELL_H_
20 | #include "./app_cfg.h"
21 | #if defined(WL_USING_SHELL)
22 |
23 | #include "../signals_slots/signals_slots.h"
24 | #include "../../generic/queue/ring_queue.h"
25 | #include "../../check_agent_engine/check_agent_engine.h"
26 | #include "finsh.h"
27 |
28 | #ifndef container_of
29 | #define container_of(ptr, type, member) \
30 | ((type *)((char *)(ptr) - (unsigned long)(&((type *)0)->member)))
31 | #endif
32 | #undef __CONNECT2
33 | #undef CONNECT2
34 | #undef __CONNECT3
35 | #undef CONNECT3
36 |
37 | #define __CONNECT3(__A, __B, __C) __A##__B##__C
38 | #define __CONNECT2(__A, __B) __A##__B
39 |
40 | #define CONNECT3(__A, __B, __C) __CONNECT3(__A, __B, __C)
41 | #define CONNECT2(__A, __B) __CONNECT2(__A, __B)
42 |
43 | #ifndef SAFE_NAME
44 | #define SAFE_NAME(__NAME) CONNECT3(__,__NAME,__LINE__)
45 | #endif
46 |
47 | #ifndef safe_atom_code
48 | #ifdef __riscv
49 | #define MSTATUS_MIE (1 << 3U)
50 | #define MSTATUS_MPIE (1 << 7U)
51 | static inline uint32_t read_mstatus(void) {
52 | uint32_t value;
53 | __asm volatile("csrr %0, mstatus" : "=r"(value));
54 | return value;
55 | }
56 | static inline void write_mstatus(uint32_t value) {
57 | __asm volatile("csrw mstatus, %0" ::"r"(value));
58 | }
59 | static inline uint32_t __get_mstatus_and_disable_irq(void) {
60 | uint32_t mstatus = 0;
61 | mstatus = read_mstatus();
62 | write_mstatus(mstatus & ~MSTATUS_MIE);
63 | return mstatus;
64 | }
65 | static inline void __set_mstatus(uint32_t mstatus) {
66 | write_mstatus(mstatus);
67 | }
68 | #define safe_atom_code()\
69 | for(uint32_t SAFE_NAME(temp) = __get_mstatus_and_disable_irq(),\
70 | *SAFE_NAME(temp3) = NULL ;\
71 | SAFE_NAME(temp3)++ == NULL;\
72 | __set_mstatus(SAFE_NAME(temp)))
73 |
74 | #else
75 | #include "cmsis_compiler.h"
76 | #define safe_atom_code() \
77 | for( uint32_t SAFE_NAME(temp) = \
78 | ({uint32_t SAFE_NAME(temp2)=__get_PRIMASK(); \
79 | __disable_irq(); \
80 | SAFE_NAME(temp2);}),*SAFE_NAME(temp3) = NULL; \
81 | SAFE_NAME(temp3)++ == NULL; \
82 | __set_PRIMASK(SAFE_NAME(temp)))
83 | #endif
84 | #endif
85 |
86 | typedef struct wl_shell_t wl_shell_t;
87 | /* Callback type definitions for various shell operations */
88 | typedef uint16_t (shell_write_call_back)(wl_shell_t *ptObj, const char* pchBuffer, uint16_t hwSize);
89 | typedef uint16_t (shell_read_call_back)(wl_shell_t *ptObj, char* pchBuffer, uint16_t hwSize);
90 | /* virtual function table for encapsulating shell operation functions */
91 | typedef struct shell_ops_t {
92 | shell_read_call_back *fnReadData; /* Callback for reading data */
93 | shell_write_call_back *fnWriteData; /* Callback for writing data */
94 | } shell_ops_t;
95 |
96 | typedef struct shell_read_timeout_t {
97 | uint8_t chState;
98 | uint16_t hwRemainSize;
99 | uint16_t hwIndex;
100 | int64_t lTimeCountms;
101 | } shell_read_timeout_t;
102 |
103 | typedef struct wl_shell_t {
104 | uint8_t chState;
105 | fsm(search_msg_map) fsmSearchMsgMap;
106 | byte_queue_t tByteInQueue;
107 | get_byte_t tGetByte;
108 | shell_read_timeout_t tReadDataTimeout;
109 | shell_ops_t tOps;
110 | uint16_t hwLineLen;
111 | uint16_t hwLinePosition;
112 | uint16_t hwCurposPosition;
113 | uint16_t hwCurrenthistory;
114 | uint16_t hwHistoryCount;
115 | bool bMutex;
116 | char chDate;
117 | char chQueueInBuf[MSG_ARG_LEN];
118 | char chReadLineBuf[MSG_ARG_LEN];
119 | char chWriteLineBuf[MSG_ARG_LEN];
120 | char cHistoryCmdBuf[SHELL_HISTORY_LINES][MSG_ARG_LEN];
121 | } wl_shell_t;
122 |
123 | typedef struct check_shell_t {
124 | check_agent_t tCheckAgent;
125 | wl_shell_t tshell;
126 | } check_shell_t;
127 |
128 | static inline uint16_t __shell_read_data_timeout(wl_shell_t *ptObj, char* pchByte, uint16_t hwSize)
129 | {
130 | if(*ptObj->tOps.fnReadData == NULL){
131 | return 0;
132 | }
133 | return (*ptObj->tOps.fnReadData)(ptObj, pchByte, hwSize);
134 | }
135 |
136 | static inline uint16_t __shell_write_data(wl_shell_t *ptObj, const char* pchByte, uint16_t hwSize)
137 | {
138 | if(*ptObj->tOps.fnWriteData == NULL){
139 | return 0;
140 | }
141 | return (*ptObj->tOps.fnWriteData)(ptObj, pchByte, hwSize);
142 | }
143 |
144 | extern check_shell_t *shell_init(check_shell_t *ptObj, shell_ops_t *ptOps);
145 | extern wl_shell_t *shell_console_get(void);
146 | extern void shell_console_set(wl_shell_t *ptConsoleShell);
147 | extern void shell_printf(const char *format, ...);
148 | #endif
149 | #endif /* APPLICATIONS_CHECK_AGENT_XMODEM_H_ */
--------------------------------------------------------------------------------
/source/communication/shell/micro_shell_cmd.c:
--------------------------------------------------------------------------------
1 | #include "micro_shell.h"
2 | #include
3 |
4 |
5 | /**
6 | * @brief Thread-safe printf function for shell console output.
7 | *
8 | * This function formats a string and writes it to the shell console's
9 | * output buffer. It ensures that the output operation is thread-safe
10 | * by using a mutex to prevent concurrent access.
11 | *
12 | * @param format The format string, followed by a variable number of arguments
13 | * to format the output according to the format string.
14 | */
15 | void shell_printf(const char *format, ...)
16 | {
17 | int result = 0; // Variable to store the formatted output result
18 | bool bEarlyReturn = false; // Flag to indicate if an early return is needed
19 | wl_shell_t *ptShell = shell_console_get(); // Get the shell console object
20 |
21 | if(ptShell != NULL) { // Check if ptShell is valid
22 | safe_atom_code() { // Enter safe atomic operation
23 | if(!ptShell->bMutex) { // If not locked
24 | ptShell->bMutex = true; // Lock to prevent concurrent access
25 | } else {
26 | bEarlyReturn = true; // Set early return flag if already locked
27 | }
28 | }
29 |
30 | if(bEarlyReturn) { // If early return is set
31 | return; // Exit the function
32 | }
33 |
34 | va_list args; // Declare variable argument list
35 | va_start(args, format); // Initialize args to point to the variable arguments
36 |
37 | // Format the string and store it in ptShell->chWriteLineBuf
38 | result = vsnprintf(ptShell->chWriteLineBuf, sizeof(ptShell->chWriteLineBuf), format, args);
39 |
40 | // Write formatted data to the shell console
41 | __shell_write_data(ptShell, ptShell->chWriteLineBuf, result);
42 |
43 | va_end(args); // End usage of variable argument list
44 | ptShell->bMutex = false; // Unlock to allow other accesses
45 | }
46 | }
47 |
48 |
49 | static int msh_help(int argc, char **argv)
50 | {
51 | #ifdef __ARMCC_VERSION
52 | extern const int FSymTab$$Base;
53 | extern const int FSymTab$$Limit;
54 | shell_printf("\r\nshell commands:\r\n");
55 | {
56 | msg_t *ptMsgTableBase = (msg_t *)&FSymTab$$Base;
57 | msg_t *ptMsgTableLimit = (msg_t *)&FSymTab$$Limit;
58 |
59 | for (uint32_t i = 0; &ptMsgTableBase[i] != ptMsgTableLimit; i++) {
60 | shell_printf("%-16s - %s\r\n", ptMsgTableBase[i].pchMessage, ptMsgTableBase[i].pchDesc);
61 | }
62 | }
63 | #elif defined (__GNUC__) || defined(__TI_COMPILER_VERSION__) || defined(__TASKING__)
64 | /* GNU GCC Compiler and TI CCS */
65 | extern const int __fsymtab_start;
66 | extern const int __fsymtab_end;
67 | shell_printf("\r\nshell commands:\r\n");
68 | {
69 | msg_t *ptMsgTableBase = (msg_t *)&__fsymtab_start;
70 | msg_t *ptMsgTableLimit = (msg_t *)&__fsymtab_end;
71 |
72 | for (uint32_t i = 0; &ptMsgTableBase[i] != ptMsgTableLimit; i++) {
73 | shell_printf("%-16s - %s\r\n", ptMsgTableBase[i].pchMessage, ptMsgTableBase[i].pchDesc);
74 | }
75 | }
76 | #endif
77 |
78 | return 0;
79 | }
80 | MSH_FUNCTION_EXPORT_CMD(msh_help, help, shell help);
81 |
--------------------------------------------------------------------------------
/source/communication/shell/vt100/app_cfg.h:
--------------------------------------------------------------------------------
1 | //! \note do not move this pre-processor statement to other places
2 | #include "..\app_cfg.h"
3 |
4 | #ifndef __WL_VT100_CFG_H__
5 | #define __WL_VT100_CFG_H__
6 |
7 | /*============================ INCLUDES ======================================*/
8 | /*============================ MACROS ========================================*/
9 | /*============================ MACROFIED FUNCTIONS ===========================*/
10 | /*============================ TYPES =========================================*/
11 | /*============================ GLOBAL VARIABLES ==============================*/
12 | /*============================ LOCAL VARIABLES ===============================*/
13 | /*============================ PROTOTYPES ====================================*/
14 |
15 | #endif
16 | /* EOF */
17 |
18 |
--------------------------------------------------------------------------------
/source/communication/shell/vt100/vt100.c:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aladdin-Wang/MicroBoot/2f802e24538da61bdd53ca84dad730084afaca03/source/communication/shell/vt100/vt100.c
--------------------------------------------------------------------------------
/source/communication/signals_slots/app_cfg.h:
--------------------------------------------------------------------------------
1 | //! \note do not move this pre-processor statement to other places
2 | #include "..\app_cfg.h"
3 |
4 | #ifndef __SIGNALS_SLOTS_CFG_H__
5 | #define __SIGNALS_SLOTS_CFG_H__
6 |
7 | /*============================ INCLUDES ======================================*/
8 | /*============================ MACROS ========================================*/
9 | /*============================ MACROFIED FUNCTIONS ===========================*/
10 | /*============================ TYPES =========================================*/
11 | /*============================ GLOBAL VARIABLES ==============================*/
12 | /*============================ LOCAL VARIABLES ===============================*/
13 | /*============================ PROTOTYPES ====================================*/
14 |
15 |
16 | #endif
17 | /* EOF */
18 |
19 |
--------------------------------------------------------------------------------
/source/communication/signals_slots/signals_slots.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aladdin-Wang/MicroBoot/2f802e24538da61bdd53ca84dad730084afaca03/source/communication/signals_slots/signals_slots.h
--------------------------------------------------------------------------------
/source/communication/subscribe_publish/app_cfg.h:
--------------------------------------------------------------------------------
1 | //! \note do not move this pre-processor statement to other places
2 | #include "..\app_cfg.h"
3 |
4 | #ifndef __SUBSCRIBE_PUBLISH_CFG_H__
5 | #define __SUBSCRIBE_PUBLISH_CFG_H__
6 |
7 | /*============================ INCLUDES ======================================*/
8 | /*============================ MACROS ========================================*/
9 | /*============================ MACROFIED FUNCTIONS ===========================*/
10 | /*============================ TYPES =========================================*/
11 | /*============================ GLOBAL VARIABLES ==============================*/
12 | /*============================ LOCAL VARIABLES ===============================*/
13 | /*============================ PROTOTYPES ====================================*/
14 |
15 | #endif
16 | /* EOF */
17 |
18 |
--------------------------------------------------------------------------------
/source/communication/subscribe_publish/subscribe_publish.c:
--------------------------------------------------------------------------------
1 | /****************************************************************************
2 | * Copyright 2022 kk (https://github.com/Aladdin-Wang) *
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 |
18 | #include "subscribe_publish.h"
19 | #if defined(USING_SUBSCRIBE_PUBLISH)
20 | #include
21 | #include
22 | #include
23 |
24 | #undef this
25 | #define this (*ptThis)
26 |
27 | static uint16_t get_byte (get_byte_t *ptThis, uint8_t *pchByte, uint16_t hwLength);
28 |
29 | wl_subscribe_publish_t *wl_subscribe_publish_init(wl_subscribe_publish_t *ptObj)
30 | {
31 | assert(NULL != ptObj);
32 |
33 | wl_subscribe_publish_t *(ptThis) = ptObj;
34 |
35 | queue_init(&this.tByteInQueue, this.chQueueBuf, sizeof(this.chQueueBuf), true);
36 | this.tGetByte.pTarget = (void *)(&this.tByteInQueue);
37 | this.tGetByte.fnGetByte = get_byte;
38 | #ifdef __ARMCC_VERSION
39 | extern const int VSymTab$$Base;
40 | extern const int VSymTab$$Limit;
41 | init_fsm(search_msg_map, &this.fsmSearchTopicMap, args((msg_t *)&VSymTab$$Base, (msg_t *)&VSymTab$$Limit, &this.tGetByte, false));
42 | #elif defined (__GNUC__) || defined(__TI_COMPILER_VERSION__) || defined(__TASKING__)
43 | /* GNU GCC Compiler and TI CCS */
44 | extern const int __vsymtab_start;
45 | extern const int __vsymtab_end;
46 | init_fsm(search_msg_map, &this.fsmSearchTopicMap, args((msg_t *)&__vsymtab_start, (msg_t *)&__vsymtab_end, &this.tByteInQueue, false));
47 | #elif defined(__ADSPBLACKFIN__) /* for VisualDSP++ Compiler */
48 | init_fsm(search_msg_map, &this.fsmSearchTopicMap, args((msg_t *)&__vsymtab_start, (msg_t *)&__vsymtab_end, &this.tByteInQueue, false));
49 | #elif defined(_MSC_VER)
50 | unsigned int *ptr_begin, *ptr_end;
51 | ptr_begin = (unsigned int *)&__vsym_begin;
52 | ptr_begin += (sizeof(struct finsh_syscall) / sizeof(unsigned int));
53 |
54 | while (*ptr_begin == 0) ptr_begin ++;
55 |
56 | ptr_end = (unsigned int *) &__vsym_end;
57 | ptr_end --;
58 |
59 | while (*ptr_end == 0) ptr_end --;
60 |
61 | init_fsm(search_msg_map, &this.fsmSearchTopicMap, args((msg_t *)ptr_begin, (msg_t *)ptr_end, &this.tByteInQueue, false));
62 | #endif
63 | return ptObj;
64 | }
65 |
66 | /**
67 | * @brief Execute shell commands
68 | *
69 | * @param ptObj Pointer to the wl_shell_t object
70 | */
71 | void wl_subscribe_publish_exec(wl_subscribe_publish_t *ptObj)
72 | {
73 | uint8_t chByte;
74 | wl_subscribe_publish_t *(ptThis) = ptObj;
75 | assert(NULL != ptObj);
76 |
77 | fsm_rt_t tFsm = call_fsm( search_msg_map, &this.fsmSearchTopicMap );
78 |
79 | if(fsm_rt_cpl == tFsm) {
80 | get_all_peeked(&this.tByteInQueue);
81 | }
82 |
83 | if(fsm_rt_user_req_drop == tFsm) {
84 | dequeue(&this.tByteInQueue, &chByte);
85 | }
86 |
87 | if(fsm_rt_on_going == tFsm) {
88 | reset_peek(&this.tByteInQueue);
89 | }
90 | }
91 |
92 | static uint16_t get_byte (get_byte_t *ptThis, uint8_t *pchByte, uint16_t hwLength)
93 | {
94 | return peek_queue(ptThis->pTarget, pchByte, hwLength);
95 | }
96 |
97 | #endif
98 |
99 |
--------------------------------------------------------------------------------
/source/communication/subscribe_publish/subscribe_publish.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Aladdin-Wang/MicroBoot/2f802e24538da61bdd53ca84dad730084afaca03/source/communication/subscribe_publish/subscribe_publish.h
--------------------------------------------------------------------------------
/source/communication/ymodem/app_cfg.h:
--------------------------------------------------------------------------------
1 | //! \note do not move this pre-processor statement to other places
2 | #include "..\app_cfg.h"
3 |
4 | #ifndef __SUBSCRIBE_PUBLISH_CFG_H__
5 | #define __SUBSCRIBE_PUBLISH_CFG_H__
6 |
7 | /*============================ INCLUDES ======================================*/
8 | /*============================ MACROS ========================================*/
9 | /*============================ MACROFIED FUNCTIONS ===========================*/
10 | /*============================ TYPES =========================================*/
11 | /*============================ GLOBAL VARIABLES ==============================*/
12 | /*============================ LOCAL VARIABLES ===============================*/
13 | /*============================ PROTOTYPES ====================================*/
14 |
15 | #endif
16 | /* EOF */
17 |
18 |
--------------------------------------------------------------------------------
/source/flash_algo/app_cfg.h:
--------------------------------------------------------------------------------
1 | //! \note do not move this pre-processor statement to other places
2 | #include "../app_cfg.h"
3 |
4 | #ifndef __FLASH_BLOB_CFG_H__
5 | #define __FLASH_BLOB_CFG_H__
6 |
7 | /* ===================== Flash device Configuration ========================= */
8 | typedef struct flash_algo_t flash_algo_t;
9 | extern const flash_algo_t onchip_flash_device;
10 | /* flash device table */
11 | #ifndef FLASH_DEV_TABLE
12 | #define FLASH_DEV_TABLE \
13 | { \
14 | &onchip_flash_device \
15 | };
16 | #endif
17 | /*============================ INCLUDES ======================================*/
18 | /*============================ MACROS ========================================*/
19 | /*============================ MACROFIED FUNCTIONS ===========================*/
20 | /*============================ TYPES =========================================*/
21 | /*============================ GLOBAL VARIABLES ==============================*/
22 | /*============================ LOCAL VARIABLES ===============================*/
23 | /*============================ PROTOTYPES ====================================*/
24 |
25 |
26 | #endif
27 | /* EOF */
28 |
29 |
--------------------------------------------------------------------------------
/source/flash_algo/flash/GD32_FLASH_DEV.c:
--------------------------------------------------------------------------------
1 | #include "../flash_algo.h"
2 | #ifdef GD32E50X
3 | #include "gd32e50x_fmc.h"
4 | static flash_dev_t const FlashDevice = {
5 | FLASH_DRV_VERS, // Driver Version, do not modify!
6 | "GD32E50X 512kB Flash", // Device Name (512kB)
7 | ONCHIP, // Device Type
8 | 0x08000000, // Device Start Address
9 | 0x00080000, // Device Size in Bytes (512kB)
10 | 0x00002000, // Programming Page Size
11 | 0, // Reserved, must be 0
12 | 0xFF, // Initial Content of Erased Memory
13 | 100, // Program Page Timeout 100 mSec
14 | 6000, // Erase Sector Timeout 6000 mSec
15 | // Specify Size and Address of Sectors
16 | 0x2000, 0x000000, // Sector Size 8kB (64 Sectors)
17 | SECTOR_END
18 | };
19 | #endif // GD32E50X_512
20 |
21 | #ifdef GD32F30X_CL
22 | #include "gd32f30x_fmc.h"
23 | static flash_dev_t const FlashDevice = {
24 | FLASH_DRV_VERS, // Driver Version, do not modify!
25 | "GD32F30X 256kB Flash", // Device Name (256kB)
26 | ONCHIP, // Device Type
27 | 0x08000000, // Device Start Address
28 | 0x00040000, // Device Size in Bytes (256kB)
29 | 0x00000800, // Programming Page Size
30 | 0, // Reserved, must be 0
31 | 0xFF, // Initial Content of Erased Memory
32 | 100, // Program Page Timeout 100 mSec
33 | 6000, // Erase Sector Timeout 6000 mSec
34 | // Specify Size and Address of Sectors
35 | 0x0800, 0x000000, // Sector Size 2kB (128 Sectors)
36 | SECTOR_END
37 | };
38 | #endif // GD32E50X_256
39 |
40 | #ifdef GD32F30X_HD
41 | #include "gd32f30x_fmc.h"
42 | static flash_dev_t const FlashDevice = {
43 | FLASH_DRV_VERS, // Driver Version, do not modify!
44 | "GD32F30X 256kB Flash", // Device Name (256kB)
45 | ONCHIP, // Device Type
46 | 0x08000000, // Device Start Address
47 | 0x00040000, // Device Size in Bytes (256kB)
48 | 0x00000800, // Programming Page Size
49 | 0, // Reserved, must be 0
50 | 0xFF, // Initial Content of Erased Memory
51 | 100, // Program Page Timeout 100 mSec
52 | 6000, // Erase Sector Timeout 6000 mSec
53 | // Specify Size and Address of Sectors
54 | 0x0800, 0x000000, // Sector Size 2kB (128 Sectors)
55 | SECTOR_END
56 | };
57 | #endif // GD32E50X_256
58 |
59 | #ifdef GD32F10X_HD
60 | #include "gd32f10x_fmc.h"
61 | static flash_dev_t const FlashDevice = {
62 | FLASH_DRV_VERS, // Driver Version, do not modify!
63 | "GD32F10X 256kB Flash", // Device Name (256kB)
64 | ONCHIP, // Device Type
65 | 0x08000000, // Device Start Address
66 | 0x00040000, // Device Size in Bytes (256kB)
67 | 0x00000800, // Programming Page Size
68 | 0, // Reserved, must be 0
69 | 0xFF, // Initial Content of Erased Memory
70 | 100, // Program Page Timeout 100 mSec
71 | 6000, // Erase Sector Timeout 6000 mSec
72 | // Specify Size and Address of Sectors
73 | 0x0800, 0x000000, // Sector Size 2kB (128 Sectors)
74 | SECTOR_END
75 | };
76 | #endif // GD32E50X_256
77 |
--------------------------------------------------------------------------------
/source/flash_algo/flash/GD32_FLASH_DRV.c:
--------------------------------------------------------------------------------
1 | #include "../flash_algo.h"
2 | #include "GD32_FLASH_DEV.c"
3 | /*
4 | * Initialize Flash Programming Functions
5 | * Parameter: adr: Device Base Address
6 | * clk: Clock Frequency (Hz)
7 | * fnc: Function Code (1 - Erase, 2 - Program, 3 - Verify)
8 | * Return Value: 0 - OK, 1 - Failed
9 | */
10 |
11 | static int32_t Init(uint32_t adr, uint32_t clk, uint32_t fnc)
12 | {
13 | fmc_unlock();
14 | return (0);
15 | }
16 |
17 | /*
18 | * De-Initialize Flash Programming Functions
19 | * Parameter: fnc: Function Code (1 - Erase, 2 - Program, 3 - Verify)
20 | * Return Value: 0 - OK, 1 - Failed
21 | */
22 |
23 | static int32_t UnInit(uint32_t fnc)
24 | {
25 | fmc_lock();
26 | return (0);
27 | }
28 |
29 | /*
30 | * Erase complete Flash Memory
31 | * Return Value: 0 - OK, 1 - Failed
32 | */
33 |
34 | static int32_t EraseChip(void)
35 | {
36 |
37 | fmc_mass_erase();
38 |
39 | return (0);
40 | }
41 |
42 | /*
43 | * Erase Sector in Flash Memory
44 | * Parameter: adr: Sector Address
45 | * Return Value: 0 - OK, 1 - Failed
46 | */
47 | static int32_t EraseSector(uint32_t adr)
48 | {
49 | fmc_page_erase(adr);
50 | return (0);
51 | }
52 |
53 | /*
54 | * Program Page in Flash Memory
55 | * Parameter: adr: Page Start Address
56 | * sz: Page Size
57 | * buf: Page Data
58 | * Return Value: 0 - OK, 1 - Failed
59 | */
60 | static int32_t ProgramPage(uint32_t addr, uint32_t sz, uint8_t* buf)
61 | {
62 | int32_t result = 0;
63 | uint32_t end_addr = addr + sz;
64 | while (addr < end_addr) {
65 | if (fmc_word_program(addr, *((uint32_t *)buf)) == FMC_READY) {
66 | if (*(uint32_t *)addr != *(uint32_t *)buf) {
67 | result = 1;
68 | break;
69 | }
70 | addr += 4;
71 | buf += 4;
72 | } else {
73 | result = 1;
74 | break;
75 | }
76 | }
77 | return result;
78 | }
79 |
80 | const flash_algo_t onchip_flash_device = {
81 | .tFlashops.Init = Init,
82 | .tFlashops.UnInit = UnInit,
83 | .tFlashops.EraseChip = EraseChip,
84 | .tFlashops.EraseSector = EraseSector,
85 | .tFlashops.Program = ProgramPage,
86 | .tFlashops.Read = NULL,
87 | .ptFlashDev = &FlashDevice,
88 | };
89 |
90 |
--------------------------------------------------------------------------------
/source/flash_algo/flash/HC32_FLASH_DEV.c:
--------------------------------------------------------------------------------
1 |
2 |
3 | #include "../flash_algo.h"
4 | #ifdef HC32F460
5 | #include "hc32_ll_efm.h"
6 | static flash_dev_t const FlashDevice = {
7 | FLASH_DRV_VERS, // Driver Version, do not modify!
8 | "HC32F460 512kB Flash", // Device Name (512kB)
9 | ONCHIP, // Device Type
10 | 0x00000000, // Device Start Address
11 | 0x00080000, // Device Size in Bytes (512kB)
12 | 0x00002000, // Programming Page Size
13 | 0, // Reserved, must be 0
14 | 0xFF, // Initial Content of Erased Memory
15 | 100, // Program Page Timeout 100 mSec
16 | 6000, // Erase Sector Timeout 6000 mSec
17 | // Specify Size and Address of Sectors
18 | 0x2000, 0x000000, // Sector Size 8kB (64 Sectors)
19 | SECTOR_END
20 | };
21 | #endif
22 |
--------------------------------------------------------------------------------
/source/flash_algo/flash/HC32_FLASH_DRV.c:
--------------------------------------------------------------------------------
1 | #include "../flash_algo.h"
2 | #include "HC32_FLASH_DEV.c"
3 | /*
4 | * Initialize Flash Programming Functions
5 | * Parameter: adr: Device Base Address
6 | * clk: Clock Frequency (Hz)
7 | * fnc: Function Code (1 - Erase, 2 - Program, 3 - Verify)
8 | * Return Value: 0 - OK, 1 - Failed
9 | */
10 |
11 | static int32_t Init(uint32_t adr, uint32_t clk, uint32_t fnc)
12 | {
13 | EFM_FWMC_Cmd(ENABLE);
14 | return (0);
15 | }
16 |
17 | /*
18 | * De-Initialize Flash Programming Functions
19 | * Parameter: fnc: Function Code (1 - Erase, 2 - Program, 3 - Verify)
20 | * Return Value: 0 - OK, 1 - Failed
21 | */
22 |
23 | static int32_t UnInit(uint32_t fnc)
24 | {
25 | EFM_FWMC_Cmd(DISABLE);
26 | return (0);
27 | }
28 |
29 | /*
30 | * Erase complete Flash Memory
31 | * Return Value: 0 - OK, 1 - Failed
32 | */
33 |
34 | static int32_t EraseChip(void)
35 | {
36 | EFM_ChipErase(EFM_CHIP_ALL);
37 | return (0);
38 | }
39 |
40 | /*
41 | * Erase Sector in Flash Memory
42 | * Parameter: adr: Sector Address
43 | * Return Value: 0 - OK, 1 - Failed
44 | */
45 | static int32_t EraseSector(uint32_t adr)
46 | {
47 | EFM_SectorErase(adr);
48 | return (0);
49 | }
50 |
51 | /*
52 | * Program Page in Flash Memory
53 | * Parameter: adr: Page Start Address
54 | * sz: Page Size
55 | * buf: Page Data
56 | * Return Value: 0 - OK, 1 - Failed
57 | */
58 | static int32_t ProgramPage(uint32_t addr, uint32_t sz, uint8_t* buf)
59 | {
60 | int32_t result = 0;
61 | /* program */
62 | if (LL_OK != EFM_Program(addr, buf, sz))
63 | {
64 | result = 1;
65 | }
66 | return result;
67 | }
68 |
69 | /*
70 | * Read Page in Flash Memory
71 | * Parameter: adr: Page Start Address
72 | * sz: Page Size
73 | * buf: Page Data
74 | * Return Value: 0 - OK, 1 - Failed
75 | */
76 | static int32_t ReadPage(uint32_t addr, uint32_t sz, uint8_t* buf)
77 | {
78 | int32_t result = 0;
79 | /* read */
80 | if (LL_OK != EFM_ReadByte(addr, buf, sz))
81 | {
82 | result = 1;
83 | }
84 | return result;
85 | }
86 |
87 | const flash_algo_t onchip_flash_device = {
88 | .tFlashops.Init = Init,
89 | .tFlashops.UnInit = UnInit,
90 | .tFlashops.EraseChip = EraseChip,
91 | .tFlashops.EraseSector = EraseSector,
92 | .tFlashops.Program = ProgramPage,
93 | .tFlashops.Read = ReadPage,
94 | .ptFlashDev = &FlashDevice,
95 | };
96 |
97 |
--------------------------------------------------------------------------------
/source/flash_algo/flash/HPM_FLASH_DEV.c:
--------------------------------------------------------------------------------
1 | #include "flash_algo.h"
2 |
3 | static flash_dev_t const FlashDevice = {
4 | FLASH_DRV_VERS, // Driver Version, do not modify!
5 | "HPM5301 1MB Flash", // Device Name (1M)
6 | ONCHIP, // Device Type
7 | 0x80000000, // Device Start Address
8 | 0x00100000, // Device Size in Bytes (1M)
9 | 0x00001000, // Programming Page Size
10 | 0, // Reserved, must be 0
11 | 0xFF, // Initial Content of Erased Memory
12 | 100, // Program Page Timeout 100 mSec
13 | 6000, // Erase Sector Timeout 6000 mSec
14 | // Specify Size and Address of Sectors
15 | 0x1000, 0x000000, // Sector Size 4kB (64 Sectors)
16 | SECTOR_END
17 | };
18 |
19 |
--------------------------------------------------------------------------------
/source/flash_algo/flash/HPM_FLASH_DRV.c:
--------------------------------------------------------------------------------
1 | #include "HPM_FLASH_DEV.c"
2 | #include "hpm_romapi.h"
3 | #include "board.h"
4 | static xpi_nor_config_t s_xpi_nor_config;
5 | /*
6 | * Initialize Flash Programming Functions
7 | * Parameter: adr: Device Base Address
8 | * clk: Clock Frequency (Hz)
9 | * fnc: Function Code (1 - Erase, 2 - Program, 3 - Verify)
10 | * Return Value: 0 - OK, 1 - Failed
11 | */
12 |
13 | static int32_t Init(uint32_t adr, uint32_t clk, uint32_t fnc)
14 | {
15 | xpi_nor_config_option_t option;
16 | option.header.U = BOARD_APP_XPI_NOR_CFG_OPT_HDR;
17 | option.option0.U = BOARD_APP_XPI_NOR_CFG_OPT_OPT0;
18 | option.option1.U = BOARD_APP_XPI_NOR_CFG_OPT_OPT1;
19 | rom_xpi_nor_auto_config(BOARD_APP_XPI_NOR_XPI_BASE, &s_xpi_nor_config, &option);
20 | return (0);
21 | }
22 |
23 | /*
24 | * De-Initialize Flash Programming Functions
25 | * Parameter: fnc: Function Code (1 - Erase, 2 - Program, 3 - Verify)
26 | * Return Value: 0 - OK, 1 - Failed
27 | */
28 |
29 | static int32_t UnInit(uint32_t fnc)
30 | {
31 |
32 | return (0);
33 | }
34 |
35 | /*
36 | * Erase complete Flash Memory
37 | * Return Value: 0 - OK, 1 - Failed
38 | */
39 |
40 | static int32_t EraseChip(void)
41 | {
42 |
43 | return (0);
44 | }
45 |
46 | /*
47 | * Erase Sector in Flash Memory
48 | * Parameter: adr: Sector Address
49 | * Return Value: 0 - OK, 1 - Failed
50 | */
51 | static int32_t EraseSector(uint32_t adr)
52 | {
53 | rom_xpi_nor_erase_sector(BOARD_APP_XPI_NOR_XPI_BASE, xpi_xfer_channel_auto, &s_xpi_nor_config, (adr - 0x80000000));
54 | return (0);
55 | }
56 |
57 | /*
58 | * Program Page in Flash Memory
59 | * Parameter: adr: Page Start Address
60 | * sz: Page Size
61 | * buf: Page Data
62 | * Return Value: 0 - OK, 1 - Failed
63 | */
64 | static int32_t ProgramPage(uint32_t addr, uint32_t sz, uint8_t* buf)
65 | {
66 | int32_t result = 0;
67 | rom_xpi_nor_program(BOARD_APP_XPI_NOR_XPI_BASE, xpi_xfer_channel_auto, &s_xpi_nor_config,
68 | (uint32_t*)buf, (addr - 0x80000000), sz);
69 | return result;
70 | }
71 |
72 | int32_t ReadData(uint32_t adr, uint32_t sz, uint8_t* buf)
73 | {
74 | int32_t result = 0;
75 | rom_xpi_nor_read(BOARD_APP_XPI_NOR_XPI_BASE, xpi_xfer_channel_auto, &s_xpi_nor_config, (uint32_t *)buf, (adr - 0x80000000), sz);
76 | return result;
77 | }
78 |
79 | const flash_algo_t onchip_flash_device = {
80 | .tFlashops.Init = Init,
81 | .tFlashops.UnInit = UnInit,
82 | .tFlashops.EraseChip = EraseChip,
83 | .tFlashops.EraseSector = EraseSector,
84 | .tFlashops.Program = ProgramPage,
85 | .tFlashops.Read = ReadData,
86 | .ptFlashDev = &FlashDevice,
87 | };
88 |
89 |
--------------------------------------------------------------------------------
/source/flash_algo/flash_algo.h:
--------------------------------------------------------------------------------
1 | /****************************************************************************
2 | * Copyright 2022 KK (https://github.com/WALI-KANG) *
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 |
18 | #ifndef FLASH_ALGO_H
19 | #define FLASH_ALGO_H
20 | #include
21 | #include
22 | #include
23 | #include
24 | #include "./app_cfg.h"
25 |
26 |
27 | #undef __CONNECT2
28 | #undef CONNECT2
29 | #undef __CONNECT3
30 | #undef CONNECT3
31 |
32 | #define __CONNECT3(__A, __B, __C) __A##__B##__C
33 | #define __CONNECT2(__A, __B) __A##__B
34 |
35 | #define CONNECT3(__A, __B, __C) __CONNECT3(__A, __B, __C)
36 | #define CONNECT2(__A, __B) __CONNECT2(__A, __B)
37 |
38 | #ifndef SAFE_NAME
39 | #define SAFE_NAME(__NAME) CONNECT3(__,__NAME,__LINE__)
40 | #endif
41 | #ifndef safe_atom_code
42 | #ifdef __riscv
43 | #define MSTATUS_MIE (1 << 3U)
44 | #define MSTATUS_MPIE (1 << 7U)
45 | static inline uint32_t read_mstatus(void) {
46 | uint32_t value;
47 | __asm volatile("csrr %0, mstatus" : "=r"(value));
48 | return value;
49 | }
50 | static inline void write_mstatus(uint32_t value) {
51 | __asm volatile("csrw mstatus, %0" ::"r"(value));
52 | }
53 | static inline uint32_t __get_mstatus_and_disable_irq(void) {
54 | uint32_t mstatus = 0;
55 | mstatus = read_mstatus();
56 | write_mstatus(mstatus & ~MSTATUS_MIE);
57 | return mstatus;
58 | }
59 | static inline void __set_mstatus(uint32_t mstatus) {
60 | write_mstatus(mstatus);
61 | }
62 | #define safe_atom_code()\
63 | for(uint32_t SAFE_NAME(temp) = __get_mstatus_and_disable_irq(),\
64 | *SAFE_NAME(temp3) = NULL ;\
65 | SAFE_NAME(temp3)++ == NULL;\
66 | __set_mstatus(SAFE_NAME(temp)))
67 |
68 | #else
69 | #include "cmsis_compiler.h"
70 | #define safe_atom_code() \
71 | for( uint32_t SAFE_NAME(temp) = \
72 | ({uint32_t SAFE_NAME(temp2)=__get_PRIMASK(); \
73 | __disable_irq(); \
74 | SAFE_NAME(temp2);}),*SAFE_NAME(temp3) = NULL; \
75 | SAFE_NAME(temp3)++ == NULL; \
76 | __set_PRIMASK(SAFE_NAME(temp)))
77 |
78 |
79 | #endif
80 | #endif
81 |
82 |
83 |
84 | #define VERS 1 // Interface Version 1.01
85 |
86 | #define UNKNOWN 0 // Unknown
87 | #define ONCHIP 1 // On-chip Flash Memory
88 | #define EXT8BIT 2 // External Flash Device on 8-bit Bus
89 | #define EXT16BIT 3 // External Flash Device on 16-bit Bus
90 | #define EXT32BIT 4 // External Flash Device on 32-bit Bus
91 | #define EXTSPI 5 // External Flash Device on SPI
92 |
93 | #define SECTOR_NUM 16 // Max Number of Sector Items
94 |
95 | #define FLASH_DRV_VERS (0x0100+VERS)
96 |
97 | #define SECTOR_END 0xFFFFFFFF, 0xFFFFFFFF
98 |
99 | struct FlashSectors {
100 | unsigned long szSector; // Sector Size in Bytes
101 | unsigned long AddrSector; // Address of Sector
102 | };
103 |
104 | typedef struct FlashDevice {
105 | unsigned short Vers; // Version Number and Architecture
106 | char DevName[128];// Device Name and Description
107 | unsigned short DevType; // Device Type: ONCHIP, EXT8BIT, EXT16BIT, ...
108 | unsigned long DevAdr; // Default Device Start Address
109 | unsigned long szDev; // Total Size of Device
110 | unsigned long szPage; // Programming Page Size
111 | unsigned long Res; // Reserved for future Extension
112 | unsigned char valEmpty; // Content of Erased Memory
113 |
114 | unsigned long toProg; // Time Out of Program Page Function
115 | unsigned long toErase; // Time Out of Erase Sector Function
116 |
117 | struct FlashSectors sectors[SECTOR_NUM];
118 | } flash_dev_t;
119 |
120 | typedef struct {
121 | int32_t (*Init)(uint32_t adr, uint32_t clk, uint32_t fnc);
122 | int32_t (*UnInit)(uint32_t fnc);
123 | int32_t (*EraseChip)(void);
124 | int32_t (*EraseSector)(uint32_t adr);
125 | int32_t (*Program)(uint32_t adr, uint32_t sz, uint8_t* buf);
126 | int32_t (*Read)(uint32_t adr, uint32_t sz, uint8_t* buf);
127 | } flash_ops_t;
128 |
129 | typedef struct flash_algo_t{
130 | flash_dev_t const *ptFlashDev;
131 | flash_ops_t tFlashops;
132 | } flash_algo_t;
133 |
134 | extern uint32_t get_flash_sector(uint32_t Address);
135 | extern uint32_t get_flash_sector_size(uint32_t Address);
136 | extern bool target_flash_init(uint32_t addr);
137 | extern bool target_flash_uninit(uint32_t addr);
138 | extern int target_flash_write(uint32_t addr, const uint8_t *buf, size_t size);
139 | extern int target_flash_erase(uint32_t addr, size_t size);
140 | extern int target_flash_read(uint32_t addr, uint8_t *buf, size_t size);
141 |
142 | #endif
143 |
--------------------------------------------------------------------------------
/source/fsm/ooc.h:
--------------------------------------------------------------------------------
1 | /****************************************************************************
2 | * Copyright 2017 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 |
18 | //#ifndef __OBJECT_ORIENTED_C_H__
19 | //#define __OBJECT_ORIENTED_C_H__
20 |
21 | /*============================ INCLUDES ======================================*/
22 | #include
23 | #include
24 |
25 | #undef __PLOOC_CLASS_USE_STRICT_TEMPLATE__
26 | #undef __PLOOC_CLASS_USE_SIMPLE_TEMPLATE__
27 | #undef __PLOOC_CLASS_USE_BLACK_BOX_TEMPLATE__
28 |
29 | #ifndef __PLOOC_I_KNOW_BLACK_BOX_IS_INCOMPATIBLE_WITH_OTHER_TEMPLATES__
30 | # define __PLOOC_I_KNOW_BLACK_BOX_IS_INCOMPATIBLE_WITH_OTHER_TEMPLATES__
31 | #endif
32 |
33 | #if !defined(__PLOOC_CLASS_USE_STRICT_TEMPLATE__) \
34 | && !defined(__PLOOC_CLASS_USE_SIMPLE_TEMPLATE__)
35 | #define __PLOOC_CLASS_USE_BLACK_BOX_TEMPLATE__
36 | #endif
37 | #include "../plooc/plooc_class.h"
38 |
39 | /*============================ MACROS ========================================*/
40 | #undef this
41 | #define this (*ptThis)
42 |
43 | /*============================ MACROFIED FUNCTIONS ===========================*/
44 | /*============================ TYPES =========================================*/
45 | /*============================ GLOBAL VARIABLES ==============================*/
46 | /*============================ LOCAL VARIABLES ===============================*/
47 | /*============================ PROTOTYPES ====================================*/
48 |
49 | //#endif
50 | /* EOF */
51 |
--------------------------------------------------------------------------------
/source/generic/app_cfg.h:
--------------------------------------------------------------------------------
1 | //! \note do not move this pre-processor statement to other places
2 | #include "../app_cfg.h"
3 |
4 | #ifndef __GENERRIC_CFG_H__
5 | #define __GENERRIC_CFG_H__
6 |
7 | /*============================ INCLUDES ======================================*/
8 | /*============================ MACROS ========================================*/
9 | /*============================ MACROFIED FUNCTIONS ===========================*/
10 | /*============================ TYPES =========================================*/
11 | /*============================ GLOBAL VARIABLES ==============================*/
12 | /*============================ LOCAL VARIABLES ===============================*/
13 | /*============================ PROTOTYPES ====================================*/
14 |
15 |
16 | #endif
17 | /* EOF */
--------------------------------------------------------------------------------
/source/generic/list/app_cfg.h:
--------------------------------------------------------------------------------
1 | //! \note do not move this pre-processor statement to other places
2 | #include "..\app_cfg.h"
3 |
4 | #ifndef __SERVE_LIST_H__
5 | #define __SERVE_LIST_H__
6 |
7 | /*============================ INCLUDES ======================================*/
8 | /*============================ MACROS ========================================*/
9 | /*============================ MACROFIED FUNCTIONS ===========================*/
10 | /*============================ TYPES =========================================*/
11 | /*============================ GLOBAL VARIABLES ==============================*/
12 | /*============================ LOCAL VARIABLES ===============================*/
13 | /*============================ PROTOTYPES ====================================*/
14 |
15 |
16 | #endif
17 | /* EOF */
18 |
19 |
--------------------------------------------------------------------------------
/source/generic/pool/app_cfg.h:
--------------------------------------------------------------------------------
1 | //! \note do not move this pre-processor statement to other places
2 | #include "..\app_cfg.h"
3 |
4 | #ifndef __MEM_POOL_APP_CFG_H__
5 | #define __MEM_POOL_APP_CFG_H__
6 |
7 | /*============================ INCLUDES ======================================*/
8 | /*============================ MACROS ========================================*/
9 | /*============================ MACROFIED FUNCTIONS ===========================*/
10 | /*============================ TYPES =========================================*/
11 | /*============================ GLOBAL VARIABLES ==============================*/
12 | /*============================ LOCAL VARIABLES ===============================*/
13 | /*============================ PROTOTYPES ====================================*/
14 |
15 |
16 | #endif
17 | /* EOF */
18 |
19 |
--------------------------------------------------------------------------------
/source/generic/pool/mem_pool.c:
--------------------------------------------------------------------------------
1 | #include "mem_pool.h"
2 | #include
3 | static void slist_push(slist_item_t **ppTop, slist_item_t *pNode)
4 | {
5 | if(pNode != NULL){
6 | pNode->ptNext = *ppTop;
7 | *ppTop = pNode;
8 | }
9 | }
10 |
11 | static void slist_pop(slist_item_t **ppTop, slist_item_t **ppNode)
12 | {
13 | if(*ppTop != NULL){
14 | *ppNode = *ppTop;
15 | *ppTop = (*ppTop)->ptNext;
16 | (*ppNode)->ptNext = NULL;
17 | }
18 | }
19 |
20 | void * pool_allocate (pool_t *ptPool)
21 | {
22 | slist_item_t *ptItem = NULL;
23 |
24 | if(ptPool->ptFreeList != NULL){
25 | slist_pop(&(ptPool->ptFreeList),&ptItem);
26 | return (void*)(ptItem);
27 | }
28 | return NULL;
29 | }
30 |
31 | void pool_free( pool_t *ptPool , void *ptItem )
32 | {
33 | if(ptPool == NULL || ptItem ==NULL) {
34 | return ;
35 | }
36 | uint32_t wKey = (uint32_t)ptItem ^ ((slist_item_t *)ptItem)->wKey;
37 | if(wKey == (uint32_t)(ptPool)){
38 | slist_push(&(ptPool->ptFreeList),(slist_item_t *)ptItem);
39 | }
40 | }
41 |
42 | bool pool_init( pool_t *ptPool )
43 | {
44 | if (NULL == ptPool) {
45 | return false;
46 | }
47 | ptPool->ptFreeList = NULL;
48 | return true;
49 | }
50 |
51 | bool pool_add_heap( pool_t *ptPool , void *ptBuffer,uint32_t wPoolSize ,uint32_t wItemSize)
52 | {
53 | if(NULL == ptBuffer || NULL == ptPool ||0 == wPoolSize || wPoolSize < wItemSize){
54 | return false;
55 | }
56 | do{
57 | slist_push(&(ptPool->ptFreeList),ptBuffer);
58 | ptPool->ptFreeList->wKey = (uint32_t)ptPool->ptFreeList ^ (uint32_t)(ptPool);
59 | ptBuffer = (void *)((uint8_t *)ptBuffer + wItemSize);
60 | wPoolSize = wPoolSize - wItemSize;
61 | }while(wPoolSize >= wItemSize);
62 | return true;
63 | }
64 |
--------------------------------------------------------------------------------
/source/generic/queue/app_cfg.h:
--------------------------------------------------------------------------------
1 | //! \note do not move this pre-processor statement to other places
2 | #include "..\app_cfg.h"
3 |
4 | #ifndef __QUEUE_APP_CFG_H__
5 | #define __QUEUE_APP_CFG_H__
6 |
7 | /*============================ INCLUDES ======================================*/
8 | /*============================ MACROS ========================================*/
9 | /*============================ MACROFIED FUNCTIONS ===========================*/
10 | /*============================ TYPES =========================================*/
11 | /*============================ GLOBAL VARIABLES ==============================*/
12 | /*============================ LOCAL VARIABLES ===============================*/
13 | /*============================ PROTOTYPES ====================================*/
14 |
15 |
16 | #endif
17 | /* EOF */
18 |
19 |
--------------------------------------------------------------------------------
/source/microboot.h:
--------------------------------------------------------------------------------
1 | #ifndef __SERVE_MICROBOOT_H_
2 | #define __SERVE_MICROBOOT_H_
3 | #include "./app_cfg.h"
4 |
5 | #ifdef __cplusplus
6 | extern "C" {
7 | #endif
8 |
9 | #include "bootloader/bootloader.h"
10 | #include "check_agent_engine/check_agent_engine.h"
11 | #include "flash_algo/flash_algo.h"
12 | #include "communication/shell/micro_shell.h"
13 | #include "communication/ymodem/ymodem.h"
14 |
15 |
16 | #ifdef __cplusplus
17 | }
18 | #endif
19 |
20 | #endif
21 |
--------------------------------------------------------------------------------
/source/soft_timer/app_cfg.h:
--------------------------------------------------------------------------------
1 | //! \note do not move this pre-processor statement to other places
2 | #include "../app_cfg.h"
3 |
4 | #ifndef __TIMER_APP_CFG_H__
5 | #define __TIMER_APP_CFG_H__
6 |
7 | /*============================ INCLUDES ======================================*/
8 | /*============================ MACROS ========================================*/
9 | /*============================ MACROFIED FUNCTIONS ===========================*/
10 | /*============================ TYPES =========================================*/
11 | /*============================ GLOBAL VARIABLES ==============================*/
12 | /*============================ LOCAL VARIABLES ===============================*/
13 | /*============================ PROTOTYPES ====================================*/
14 |
15 |
16 | #endif
17 | /* EOF */
18 |
19 |
--------------------------------------------------------------------------------
/template/no_semihosting.c:
--------------------------------------------------------------------------------
1 | /**
2 | * 此文件用于关闭 semihosting
3 | */
4 | //! \note for IAR
5 | #ifdef __IS_COMPILER_IAR__
6 | # undef __IS_COMPILER_IAR__
7 | #endif
8 | #if defined(__IAR_SYSTEMS_ICC__)
9 | # define __IS_COMPILER_IAR__ 1
10 | #endif
11 |
12 | //! \note for arm compiler 5
13 | #ifdef __IS_COMPILER_ARM_COMPILER_5__
14 | # undef __IS_COMPILER_ARM_COMPILER_5__
15 | #endif
16 | #if ((__ARMCC_VERSION >= 5000000) && (__ARMCC_VERSION < 6000000))
17 | # define __IS_COMPILER_ARM_COMPILER_5__ 1
18 | #endif
19 | //! @}
20 |
21 | //! \note for arm compiler 6
22 | #ifdef __IS_COMPILER_ARM_COMPILER_6__
23 | # undef __IS_COMPILER_ARM_COMPILER_6__
24 | #endif
25 | #if ((__ARMCC_VERSION >= 6000000) && (__ARMCC_VERSION < 7000000))
26 | # define __IS_COMPILER_ARM_COMPILER_6__ 1
27 | #endif
28 |
29 | #ifdef __IS_COMPILER_ARM_COMPILER__
30 | # undef __IS_COMPILER_ARM_COMPILER__
31 | #endif
32 | #if defined(__IS_COMPILER_ARM_COMPILER_5__) && __IS_COMPILER_ARM_COMPILER_5__ \
33 | || defined(__IS_COMPILER_ARM_COMPILER_6__) && __IS_COMPILER_ARM_COMPILER_6__
34 | # define __IS_COMPILER_ARM_COMPILER__ 1
35 | #endif
36 |
37 | #ifdef __IS_COMPILER_LLVM__
38 | # undef __IS_COMPILER_LLVM__
39 | #endif
40 | #if defined(__clang__) && !__IS_COMPILER_ARM_COMPILER_6__
41 | # define __IS_COMPILER_LLVM__ 1
42 | #else
43 | //! \note for gcc
44 | #ifdef __IS_COMPILER_GCC__
45 | # undef __IS_COMPILER_GCC__
46 | #endif
47 | #if defined(__GNUC__) && !(__IS_COMPILER_ARM_COMPILER_6__ || __IS_COMPILER_LLVM__)
48 | # define __IS_COMPILER_GCC__ 1
49 | #endif
50 | //! @}
51 | #endif
52 | //! @}
53 |
54 |
55 | /* 告诉编译器若没有使用 MicroLIB ,则 main() 函数不需要入口参数 */
56 | #if __IS_COMPILER_ARM_COMPILER_6__
57 | #ifndef __MICROLIB
58 | __asm(".global __ARM_use_no_argv\n\t");
59 | #endif
60 | #endif
61 |
62 | /* 关闭 semihosting */
63 | #if __IS_COMPILER_ARM_COMPILER_6__
64 | __asm(".global __use_no_semihosting");
65 |
66 | /* AC6 会因为关闭 semihosting 缺这个函数,所以要补上 */
67 | void _sys_exit(int ret)
68 | {
69 | (void)ret;
70 | while(1) {}
71 | }
72 | #elif __IS_COMPILER_ARM_COMPILER_5__
73 | #pragma import(__use_no_semihosting)
74 | #endif
75 |
76 | /* AC5 和 AC6 都会因为关闭 semihosting 缺这个函数,所以要补上 */
77 | #if __IS_COMPILER_ARM_COMPILER__
78 | void _ttywrch(int ch)
79 | {
80 | (void)ch;
81 | }
82 | #endif
83 |
84 | /* 当使用 AC6 开启 MicroLIB 时,若有使用 assert() 的需求,需要自己实现 __aeabi_assert() */
85 | #if __IS_COMPILER_ARM_COMPILER_6__ && defined(__MICROLIB)
86 | #include "RTE_Components.h "
87 | #if (!defined(RTE_CMSIS_Compiler_STDOUT) && !defined(RTE_Compiler_IO_STDOUT))
88 | void __aeabi_assert(const char *chCond, const char *chLine, int wErrCode)
89 | {
90 | (void)chCond;
91 | (void)chLine;
92 | (void)wErrCode;
93 |
94 | for (;;);
95 | }
96 | #endif
97 | #endif
98 |
99 |
100 | /* 当用户没有使用printf时,通过添加如下的代码来让编译器避免报错 */
101 | #if __IS_COMPILER_ARM_COMPILER_6__
102 | #include "RTE_Components.h "
103 | # ifdef __MICROLIB
104 | #include
105 | #if (!defined(RTE_CMSIS_Compiler_STDOUT) && !defined(RTE_Compiler_IO_STDOUT))
106 | int fputc(int ch, FILE *f)
107 | {
108 | (void) f;
109 | (void) ch;
110 |
111 | return ch;
112 | }
113 | #endif
114 | # else
115 | #include
116 | #if (!defined(RTE_CMSIS_Compiler_STDOUT) && !defined(RTE_Compiler_IO_STDOUT))
117 | FILEHANDLE $Sub$$_sys_open(const char *name, int openmode)
118 | {
119 | (void) name;
120 | (void) openmode;
121 | return 0;
122 | }
123 | #endif
124 | # endif
125 |
126 | #endif
127 |
128 |
--------------------------------------------------------------------------------
/template/user_app_cfg.h:
--------------------------------------------------------------------------------
1 | /* WALI Serve config file */
2 | #ifndef __WL_CFG_H__
3 | #define __WL_CFG_H__
4 |
5 | // <<< Use Configuration Wizard in Context Menu >>>
6 |
7 | // Log Configuration
8 | // enable kernel debug configuration
9 | // Default: enable kernel debug configuration
10 | //#define RT_DEBUG
11 | //
12 | // enable components initialization debug configuration<0-1>
13 | // Default: 0
14 | #define RT_DEBUG_INIT 0
15 | // thread stack over flow detect
16 | // Diable Thread stack over flow detect
17 | //#define RT_USING_OVERFLOW_CHECK
18 | //
19 | //
20 | // Msg Map Configuration
21 | // Enables msg_map
22 | #define USING_MSG_MAP 1
23 | #if USING_MSG_MAP == 0
24 | #undef USING_MSG_MAP
25 | #endif
26 | // The maximum length of parameters <0-128>
27 | // Default: 128
28 | #define MSG_ARG_LEN 128
29 | // The maximum number of parameters <0-16>
30 | // Default: 8
31 | #define MSG_ARG_MAX 8
32 | //
33 |
34 | // Flash BLOB Configuration
35 | // Flash BLOB Management
36 | // Flash BLOB Management
37 | #define USING_FLASH_BLOB
38 | //
39 | //
40 |
41 | // Check Use Peek
42 | // check use peek engine
43 | // check use peek engine
44 | #define USING_CHECK_ENGINE
45 | //
46 | //
47 |
48 | // Shell Configuration
49 | // Enables shell
50 | #define WL_USING_SHELL 1
51 | #if WL_USING_SHELL == 0
52 | #undef WL_USING_SHELL
53 | #endif
54 | // Use echo mode
55 | // FINSH_OPTION_ECHO=0x01 is echo mode, other values are none-echo mode.
56 | #define SHELL_OPTION_ECHO 1
57 | // The maximum number of history lines <0-16>
58 | // Default: 8
59 | #define SHELL_HISTORY_LINES 5
60 | //
61 | // IPC(Inter-process communication) Configuration
62 | // Using Ring Queue
63 | // Using Ring Queue
64 | #define USING_RINGEQUEUE
65 | //
66 | // Using Signals-Slots
67 | // Using Signals-Slots
68 | #define USING_SIGNALS_SLOTS
69 | //
70 | // Using Subscribe-Publish
71 | // Using Subscribe-Publish
72 | #define USING_SUBSCRIBE_PUBLISH
73 | //
74 | // Using Event
75 | // Using Event
76 | //#define WL_USING_EVENT
77 | //
78 | // Using MailBox
79 | // Using MailBox
80 | //#define WL_USING_MAILBOX
81 | //
82 | //
83 | // Memory Management Configuration
84 | // Memory Pool Management
85 | // Memory Pool Management
86 | //#define RT_USING_MEMPOOL
87 | //
88 | //
89 | // BootLoader Configuration
90 | // Enables BootLoader
91 | #define USING_BOOT 1
92 | #if USING_BOOT == 0
93 | #undef USING_BOOT
94 | #endif
95 | // The starting address of the app
96 | // Default: 0x8020000
97 | // Must align with flash sector size
98 | #define APP_PART_ADDR 0x08020000
99 | // The reset vector offset in the application
100 | // Default: 0x4
101 | // The offset of the reset vector from the application start
102 | #define APP_PART_OFFSET 0x4
103 | // The app size
104 | // Default: 0X60000
105 | // Must align with flash sector size
106 | #define APP_PART_SIZE 0x60000
107 | // The Boot Flash Ops Addr
108 | // Default: 0x08001000
109 | // Must align with flash sector size
110 | #define BOOT_FLASH_OPS_ADDR 0x08001000
111 | //
112 |
113 | // <<< end of configuration section >>>
114 | #endif
115 |
--------------------------------------------------------------------------------