-
Notifications
You must be signed in to change notification settings - Fork 230
Cole gbk test #2012
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
wangli65535
wants to merge
3
commits into
dev-nexfirmware-evt1
Choose a base branch
from
Cole_gbk_test
base: dev-nexfirmware-evt1
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Cole gbk test #2012
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
mcu_client/nrf5340_ble_simulator/scripts/FONT_FLASH_QSPI.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| # Flash Font to QSPI (XIP Address) | ||
|
|
||
| Convert an LVGL binfont (`.bin`) to Intel HEX and program it onto the nRF5340 DK external QSPI Flash for XIP (execute-in-place) use. | ||
|
|
||
| ## Prerequisites | ||
|
|
||
| - **ARM GCC** installed (`arm-none-eabi-objcopy` on PATH) | ||
| - **nRF Util** installed (`nrfutil`) | ||
| - Device connected via USB; **serial number** known (e.g. `771549234`) | ||
| - Font XIP base address matches the project (example `0x100f0000`; see `pm_static.yml` / Kconfig) | ||
|
|
||
| ## Step 1: BIN → HEX (with XIP address) | ||
|
|
||
| Convert the font binary to Intel HEX and set the load address in QSPI: | ||
|
|
||
| ```bash | ||
| arm-none-eabi-objcopy -I binary -O ihex \ | ||
| --change-addresses 0x100f0000 \ | ||
| mcu_client/nrf5340_ble_simulator/scripts/font_zh_en_18_lvgl_1.bin \ | ||
| mcu_client/nrf5340_ble_simulator/scripts/font_zh_en_18_lvgl_1.hex | ||
| ``` | ||
|
|
||
| - `--change-addresses 0x100f0000`: Must match the font XIP base address in firmware (see `pm_static.yml` font_storage or Kconfig `PM_FONT_STORAGE_ADDRESS`). Change if your partition uses a different address. | ||
| - Paths above are **relative to the repo root**; run from the repo root or use absolute paths as needed. | ||
|
|
||
| ## Step 2: Program to device | ||
|
|
||
| Program the HEX to external QSPI with nrfutil: | ||
|
|
||
| ```bash | ||
| nrfutil device --x-ext-mem-config-file mcu_client/nrf5340_ble_simulator/scripts/nrf5340dk_qspi_ext_mem_config.json program \ | ||
| --firmware mcu_client/nrf5340_ble_simulator/scripts/font_zh_en_18_lvgl_1.hex \ | ||
| --serial-number 771549234 \ | ||
| --options ext_mem_erase_mode=ERASE_RANGES_TOUCHED_BY_FIRMWARE,chip_erase_mode=ERASE_NONE,verify=VERIFY_READ | ||
| ``` | ||
|
|
||
| - `--serial-number`: Use your device’s serial (run `nrfutil device list` to find it). | ||
| - `ext_mem_erase_mode=ERASE_RANGES_TOUCHED_BY_FIRMWARE`: Erase only QSPI ranges covered by the HEX. | ||
| - `chip_erase_mode=ERASE_NONE`: Do not full-chip erase. | ||
| - `verify=VERIFY_READ`: Verify after programming by reading back. | ||
|
|
||
| ## Troubleshooting | ||
|
|
||
| - **Wrong address**: If the firmware cannot read the font, check that `--change-addresses` matches the font_storage base in `pm_static.yml` / Kconfig. | ||
| - **Device not found**: Run `nrfutil device list` to confirm the device and serial number. | ||
| - **Permissions / drivers**: On Linux you may need udev rules or sudo; on Windows install the J-Link driver. |
22 changes: 22 additions & 0 deletions
22
mcu_client/nrf5340_ble_simulator/scripts/nrf5340dk_qspi_ext_mem_config.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| { | ||
| "firmware_config": { | ||
| "peripheral": "QSPI" | ||
| }, | ||
| "pins": { | ||
| "sck": 17, | ||
| "csn": 18, | ||
| "io0": 13, | ||
| "io1": 14, | ||
| "io2": 15, | ||
| "io3": 16 | ||
| }, | ||
| "flash_size": 33554432, | ||
| "sck_frequency": 8000000, | ||
| "address_mode": "MODE32BIT", | ||
| "readoc": "READ4IO", | ||
| "writeoc": "PP4IO", | ||
| "pp_size": "PPSIZE256", | ||
| "sck_delay": 128, | ||
| "rx_delay": 2, | ||
| "page_size": 4096 | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
mcu_client/nrf5340_ble_simulator/src/mos_components/mos_font_storage/CMakeLists.txt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| # Copyright (c) MentraOS Contributors | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| target_include_directories(app PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include) | ||
| target_sources(app PRIVATE | ||
| ${CMAKE_CURRENT_SOURCE_DIR}/src/mos_font_storage.c | ||
| ${CMAKE_CURRENT_SOURCE_DIR}/src/mos_binfont_lvgl.c | ||
| ) |
44 changes: 44 additions & 0 deletions
44
...ient/nrf5340_ble_simulator/src/mos_components/mos_font_storage/include/mos_binfont_lvgl.h
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| /*** | ||
| * @Author : Cole | ||
| * @Date : 2026-02-05 14:53:31 | ||
| * @LastEditTime : 2026-02-10 15:46:31 | ||
| * @FilePath : mos_binfont_lvgl.h | ||
| * @Description : | ||
| * @ | ||
| * @ Copyright (c) MentraOS Contributors 2026 | ||
| * @ SPDX-License-Identifier: Apache-2.0 | ||
| */ | ||
|
|
||
| #ifndef MOS_BINFONT_LVGL_H | ||
| #define MOS_BINFONT_LVGL_H | ||
|
|
||
| #include <stdbool.h> | ||
| #include <stdint.h> | ||
|
|
||
| #if defined(CONFIG_LVGL) | ||
| #include <lvgl.h> | ||
|
|
||
| /** | ||
| * 获取自定义中文字体实例 | ||
| * @return LVGL字体指针,如果初始化失败返回NULL | ||
| */ | ||
| const lv_font_t* mos_binfont_get_lvgl_font(void); | ||
|
|
||
| /** | ||
| * 初始化binfont LVGL字体 | ||
| * @return 0成功,负数错误码 | ||
| */ | ||
| int mos_binfont_lvgl_init(void); | ||
|
|
||
| /** | ||
| * 释放binfont LVGL字体资源 | ||
| */ | ||
| void mos_binfont_lvgl_deinit(void); | ||
|
|
||
|
|
||
| int mos_binfont_debug_glyph_region(uint32_t unicode, uint32_t *out_glyph_id, | ||
| uint32_t *out_start, uint32_t *out_len); | ||
|
|
||
| #endif /* CONFIG_LVGL */ | ||
|
|
||
| #endif /* MOS_BINFONT_LVGL_H */ |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove this please.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
okay