日B视频 亚洲,啪啪啪网站一区二区,91色情精品久久,日日噜狠狠色综合久,超碰人妻少妇97在线,999青青视频,亚洲一区二卡,让本一区二区视频,日韩网站推荐

0
  • 聊天消息
  • 系統(tǒng)消息
  • 評論與回復(fù)
登錄后你可以
  • 下載海量資料
  • 學(xué)習(xí)在線課程
  • 觀看技術(shù)視頻
  • 寫文章/發(fā)帖/加入社區(qū)
會員中心
創(chuàng)作中心

完善資料讓更多小伙伴認識你,還能領(lǐng)取20積分哦,立即完善>

3天內(nèi)不再提示

【LPC55S69】使用FAL分區(qū)管理與easyflash變量管理(下集)

恩智浦MCU加油站 ? 來源:未知 ? 2023-06-29 09:05 ? 次閱讀
加入交流群
微信小助手二維碼

掃碼添加小助手

加入工程師交流群

上期帶大家了解了FAL組件和DFS文件系統(tǒng)的功能特點和使用方法,本期將繼續(xù)解讀如何將EasyFlsh移植到FAL分區(qū)。

簡述EasyFlash

關(guān)于EasyFlash的來源我們已經(jīng)講過,EasyFlash是一款開源的輕量級嵌入式Flash存儲器庫,方便開發(fā)者更加輕松的實現(xiàn)基于Flash存儲器的常見應(yīng)用開發(fā)。非常適合智能家居、可穿戴、工控、醫(yī)療、物聯(lián)網(wǎng)等需要斷電存儲功能的產(chǎn)品,資源占用極低,支持各種 MCU 片上存儲器。

EasyFlash不僅能夠?qū)崿F(xiàn)對產(chǎn)品的設(shè)定參數(shù)或運行日志等信息的掉電保存功能,還封裝了簡潔的增加、刪除、修改及查詢方法,降低了開發(fā)者對產(chǎn)品參數(shù)的處理難度,也保證了產(chǎn)品在后期升級時擁有更好的擴展性。讓Flash變?yōu)镹oSQL(非關(guān)系型數(shù)據(jù)庫)模型的小型鍵值(Key-Value)存儲數(shù)據(jù)庫。

EasyFlash軟件包使用

打開ENV進入路徑:RT-Thread online packages → tools packages → EasyFlash: Lightweight embedded flash memory library.,選擇軟件包版本為最新版。配置后退出ENV,同時使用pkgs --update下載軟件包,然后再使用scons-target=mdk5重新生成MDK5文件。

4936011e-1615-11ee-962d-dac502259ad0.png

移植EasyFlash

下載完easyflash軟件包后,我們復(fù)制. t-threadsplpc55sxxlpc55s69_nxp_evkpackagesEasyFlash-latestportsef_fal_port.c到目錄. t-threadsplpc55sxxlpc55s69_nxp_evkoardportseasyflashef_fal_port.c,雙擊打開該文件,完成以下修改:

// 修改 FAL_EF_PART_NAME 為 easyflash
#define FAL_EF_PART_NAME               "easyflash"

編寫EasyFlash測試用例

/*
  * Copyright (c) 2006-2023, RT-Thread Development Team
  *
  * SPDX-License-Identifier: Apache-2.0
  *
  * Change Logs:
  * Date           Author       Notes
  * 2023-04-21     Wangyuqiang  the first version
  */


#include "rtthread.h"
#include "rtdevice.h"
#include "board.h"
#include "fal.h"


#include 


#include "easyflash.h"
#include 


#define FS_PARTITION_NAME  "filesystem"


#define BUF_SIZE 1024


static int fal_test(const char *partiton_name)
{
int ret;
int i, j, len;
uint8_t buf[BUF_SIZE];
const struct fal_flash_dev *flash_dev = RT_NULL;
const struct fal_partition *partition = RT_NULL;


if (!partiton_name)
     {
         rt_kprintf("Input param partition name is null!
");
return -1;
     }


     partition = fal_partition_find(partiton_name);
if (partition == RT_NULL)
     {
         rt_kprintf("Find partition (%s) failed!
", partiton_name);
         ret = -1;
return ret;
     }


     flash_dev = fal_flash_device_find(partition->flash_name);
if (flash_dev == RT_NULL)
     {
         rt_kprintf("Find flash device (%s) failed!
", partition->flash_name);
         ret = -1;
return ret;
     }


     rt_kprintf("Flash device : %s   "
"Flash size : %dK   
"
"Partition : %s   "
"Partition size: %dK
",
                 partition->flash_name,
                 flash_dev->len/1024,
                 partition->name,
                 partition->len/1024);


/* erase all partition */
     ret = fal_partition_erase_all(partition);
if (ret < 0)
     {
         rt_kprintf("Partition (%s) erase failed!
", partition->name);
         ret = -1;
return ret;
     }
     rt_kprintf("Erase (%s) partition finish!
", partiton_name);


/* read the specified partition and check data */
for (i = 0; i < partition->len;)
     {
         rt_memset(buf, 0x00, BUF_SIZE);


         len = (partition->len - i) > BUF_SIZE ? BUF_SIZE : (partition->len - i);


         ret = fal_partition_read(partition, i, buf, len);
if (ret < 0)
         {
             rt_kprintf("Partition (%s) read failed!
", partition->name);
             ret = -1;
return ret;
         }


for(j = 0; j < len; j++)
         {
if (buf[j] != 0xFF)
             {
                 rt_kprintf("The erase operation did not really succeed!
");
                 ret = -1;
return ret;
             }
         }
         i += len;
     }


/* write 0x00 to the specified partition */
for (i = 0; i < partition->len;)
     {
         rt_memset(buf, 0x00, BUF_SIZE);


         len = (partition->len - i) > BUF_SIZE ? BUF_SIZE : (partition->len - i);


         ret = fal_partition_write(partition, i, buf, len);
if (ret < 0)
         {
             rt_kprintf("Partition (%s) write failed!
", partition->name);
             ret = -1;
return ret;
         }


         i += len;
     }
     rt_kprintf("Write (%s) partition finish! Write size %d(%dK).
", partiton_name, i, i/1024);


/* read the specified partition and check data */
for (i = 0; i < partition->len;)
     {
         rt_memset(buf, 0xFF, BUF_SIZE);


         len = (partition->len - i) > BUF_SIZE ? BUF_SIZE : (partition->len - i);


         ret = fal_partition_read(partition, i, buf, len);
if (ret < 0)
         {
             rt_kprintf("Partition (%s) read failed!
", partition->name);
             ret = -1;
return ret;
         }


for(j = 0; j < len; j++)
         {
if (buf[j] != 0x00)
             {
                 rt_kprintf("The write operation did not really succeed!
");
                 ret = -1;
return ret;
             }
         }


         i += len;
     }


     ret = 0;
return ret;
}


static void fal_sample(void)
{
/* 1- init */
     fal_init();


if (fal_test("font") == 0)
     {
         rt_kprintf("Fal partition (%s) test success!
", "font");
     }
else
     {
         rt_kprintf("Fal partition (%s) test failed!
", "font");
     }


if (fal_test("download") == 0)
     {
         rt_kprintf("Fal partition (%s) test success!
", "download");
     }
else
     {
         rt_kprintf("Fal partition (%s) test failed!
", "download");
     }
}
MSH_CMD_EXPORT(fal_sample, fal sample);


static void fal_elmfat_sample(void)
{
int fd, size;
struct statfs elm_stat;
struct fal_blk_device *blk_dev;
char str[] = "elmfat mount to W25Q flash.", buf[80];


/* fal init */
     fal_init();


/* create block device */
     blk_dev = (struct fal_blk_device *)fal_blk_device_create(FS_PARTITION_NAME);
if(blk_dev == RT_NULL)
         rt_kprintf("Can't create a block device on '%s' partition.
", FS_PARTITION_NAME);
else
         rt_kprintf("Create a block device on the %s partition of flash successful.
", FS_PARTITION_NAME);


/* make a elmfat format filesystem */
if(dfs_mkfs("elm", FS_PARTITION_NAME) == 0)
         rt_kprintf("make elmfat filesystem success.
");


/* mount elmfat file system to FS_PARTITION_NAME */
if(dfs_mount(FS_PARTITION_NAME, "/", "elm", 0, 0) == 0)
         rt_kprintf("elmfat filesystem mount success.
");


/* Get elmfat file system statistics */
if(statfs("/", &elm_stat) == 0)
         rt_kprintf("elmfat filesystem block size: %d, total blocks: %d, free blocks: %d.
",
                     elm_stat.f_bsize, elm_stat.f_blocks, elm_stat.f_bfree);


if(mkdir("/user", 0x777) == 0)
         rt_kprintf("make a directory: '/user'.
");


     rt_kprintf("Write string '%s' to /user/test.txt.
", str);


/* Open the file in create and read-write mode, create the file if it does not exist*/
     fd = open("/user/test.txt", O_WRONLY | O_CREAT);
if (fd >= 0)
     {
if(write(fd, str, sizeof(str)) == sizeof(str))
             rt_kprintf("Write data done.
");


         close(fd);   
     }


/* Open file in read-only mode */
     fd = open("/user/test.txt", O_RDONLY);
if (fd >= 0)
     {
         size = read(fd, buf, sizeof(buf));


         close(fd);


if(size == sizeof(str))
             rt_kprintf("Read data from file test.txt(size: %d): %s 
", size, buf);
     }
}
MSH_CMD_EXPORT_ALIAS(fal_elmfat_sample, fal_elmfat,fal elmfat sample);


static void easyflash_sample(void)
{
/* fal init */
     fal_init();


/* easyflash init */
if(easyflash_init() == EF_NO_ERR)
     {
uint32_t i_boot_times = NULL;
char *c_old_boot_times, c_new_boot_times[11] = {0};


/* get the boot count number from Env */
         c_old_boot_times = ef_get_env("boot_times");
/* get the boot count number failed */
if (c_old_boot_times == RT_NULL)
             c_old_boot_times[0] = '0';


         i_boot_times = atol(c_old_boot_times);
/* boot count +1 */
         i_boot_times ++;
         rt_kprintf("===============================================
");
         rt_kprintf("The system now boot %d times
", i_boot_times);
         rt_kprintf("===============================================
");
/* interger to string */
sprintf(c_new_boot_times, "%d", i_boot_times);
/* set and store the boot count number to Env */
         ef_set_env("boot_times", c_new_boot_times);
         ef_save_env();
     }
}
MSH_CMD_EXPORT(easyflash_sample, easyflash sample);

EasyFlash測試結(jié)果

打開串口助手,輸入命令:
  1. msh />easyflash_sample

復(fù)制代碼

第一次命令調(diào)用:49613442-1615-11ee-962d-dac502259ad0.png第二次RESET開發(fā)板后調(diào)用:

498e3712-1615-11ee-962d-dac502259ad0.png

結(jié)語

至此,F(xiàn)AL分區(qū)管理EasyFlash變量管理已經(jīng)全部介紹完畢了,經(jīng)歷從移植軟件模擬SPI框架到LPC55S69,到移植過程中不斷遇到的問題,解決問題并提供應(yīng)用示例,并完成開發(fā)日記、開發(fā)筆記及應(yīng)用教學(xué),作者坦言整個過程還是受益良多的。希望大家懷揣著一顆求知及授學(xué)之心,共同建設(shè)好這個領(lǐng)域!

參考資料:

  • IOT-OS之RT-Thread(十一)--- FAL分區(qū)管理與easyflash變量管理

  • RT-Thread文檔中心:FAL組件

本文轉(zhuǎn)載自:

END

更多恩智浦AI-IoT市場和產(chǎn)品信息,邀您同時關(guān)注“NXP客?!蔽⑿殴娞?/span>

49c10750-1615-11ee-962d-dac502259ad0.jpg ? ? ?

NXP客棧


恩智浦致力于打造安全的連接和基礎(chǔ)設(shè)施解決方案,為智慧生活保駕護航。

長按二維碼,關(guān)注我們

恩智浦MCU加油站


這是由恩智浦官方運營的公眾號,著重為您推薦恩智浦MCU的產(chǎn)品信息、開發(fā)技巧、教程文檔、培訓(xùn)課程等內(nèi)容。

49d4e6b2-1615-11ee-962d-dac502259ad0.jpg ?

長按二維碼,關(guān)注我們


原文標題:【LPC55S69】使用FAL分區(qū)管理與easyflash變量管理(下集)

文章出處:【微信公眾號:恩智浦MCU加油站】歡迎添加關(guān)注!文章轉(zhuǎn)載請注明出處。


聲明:本文內(nèi)容及配圖由入駐作者撰寫或者入駐合作網(wǎng)站授權(quán)轉(zhuǎn)載。文章觀點僅代表作者本人,不代表電子發(fā)燒友網(wǎng)立場。文章及其配圖僅供工程師學(xué)習(xí)之用,如有內(nèi)容侵權(quán)或者其他違規(guī)問題,請聯(lián)系本站處理。 舉報投訴
  • mcu
    mcu
    +關(guān)注

    關(guān)注

    147

    文章

    19160

    瀏覽量

    404828
  • 恩智浦
    +關(guān)注

    關(guān)注

    14

    文章

    6129

    瀏覽量

    155247

原文標題:【LPC55S69】使用FAL分區(qū)管理與easyflash變量管理(下集)

文章出處:【微信號:NXP_SMART_HARDWARE,微信公眾號:恩智浦MCU加油站】歡迎添加關(guān)注!文章轉(zhuǎn)載請注明出處。

收藏 人收藏
加入交流群
微信小助手二維碼

掃碼添加小助手

加入工程師交流群

    評論

    相關(guān)推薦
    熱點推薦

    有關(guān) keyboard2mouse 示例的問題求解

    ; LPCIP3511HS <--> LPC55S69 <--> OHCI <--> Keyboard 但我想將作模式修改為: PC
    發(fā)表于 04-28 07:54

    從 FRAM 讀取數(shù)據(jù)期間 I2C 通信卡住了,怎么解決?

    我最近開始在控制器上工作LPC55S69我正在嘗試通過 I2C 總線從 FRAM 讀取數(shù)據(jù)。但是有時我面臨從 FRAM 讀取數(shù)據(jù)的問題,因為我的代碼在讀取數(shù)據(jù)時卡住了。我已經(jīng)配置了 I2C 超時
    發(fā)表于 04-23 06:56

    為什么無法在 LPC55S36 上使用 BLHost 轉(zhuǎn)儲代碼(兩塊板上的 USB 連接問題)?

    。 設(shè)置詳細信息: 工具:BLHost 2.6.7 主機作系統(tǒng):Windows 10 連接:USB 電纜(在設(shè)備管理器中檢測到 COM 端口) 目標:LPC55S36 MCU 驅(qū)動程序:已安裝并驗證
    發(fā)表于 04-17 10:04

    使用 LPC55S69 和 MCUX 驅(qū)動程序的 CDC 應(yīng)該實現(xiàn)什么樣的吞吐量?

    我有一塊基于LPC55S69的板,該板目前具有一個以太網(wǎng)接口,可傳輸大約 800 kbps 的數(shù)據(jù)(在任一方向上,但雙向總數(shù)應(yīng)保持大致相同。客戶想看看我們是否可以取消以太網(wǎng)接口,而是通過 USB
    發(fā)表于 04-16 09:20

    無法獲得在 StarFive 上運行的 StarFive Linux 映像的 5569 版本,怎么解決?

    我是 VisionFive 2 的超級早鳥支持者,我無法獲得在 StarFive 上運行的 StarFive Linux 映像的 5569 版本。綠色 LED 永遠不會亮起。我嘗試過使用此方法
    發(fā)表于 03-20 07:39

    Linux磁盤管理指令合集:從查看、分區(qū)到修復(fù)

    在 Linux 服務(wù)器運維或日常使用中,磁盤管理是高頻操作 —— 無論是排查磁盤空間不足的問題,還是新增硬盤后的分區(qū)配置,都離不開一系列核心指令。今天就為大家整理一份「Linux 磁盤管理指令操作集」,按功能分類講解,附帶示例和
    的頭像 發(fā)表于 02-03 16:07 ?3554次閱讀
    Linux磁盤<b class='flag-5'>管理</b>指令合集:從查看、<b class='flag-5'>分區(qū)</b>到修復(fù)

    城市用水分區(qū)計量管理系統(tǒng)方案

    浪費,增加供水企業(yè)運營成本,也難以精準響應(yīng)不同區(qū)域的用水需求,影響供水服務(wù)質(zhì)量與居民用水體驗。 為此,物通博聯(lián)以工業(yè)數(shù)采網(wǎng)關(guān)為核心,構(gòu)建城市用水分區(qū)計量管理系統(tǒng),實現(xiàn)對城市各區(qū)域用水?dāng)?shù)據(jù)的實時采集、動態(tài)監(jiān)控、
    的頭像 發(fā)表于 09-09 10:37 ?738次閱讀
    城市用水<b class='flag-5'>分區(qū)</b>計量<b class='flag-5'>管理</b>系統(tǒng)方案

    【PCA9958HN-ARD】GUI工具的使用

    :PCA9958HN-ARD評估板快速入門 | NXP 半導(dǎo)體),里面包含GUI上位機軟件的安裝包和LPC55S69開發(fā)板的固件。 然后,點擊setup.exe,進行GUI上位機軟件的安裝,安裝
    發(fā)表于 06-29 10:07

    Linux系統(tǒng)中磁盤分區(qū)與掛載詳解

    磁盤分區(qū)是將物理硬盤劃分為不同的邏輯部分,每個分區(qū)都可以被視為一個獨立的存儲設(shè)備。通過磁盤分區(qū),我們可以更好地管理磁盤空間,實現(xiàn)數(shù)據(jù)的組織和隔離。
    的頭像 發(fā)表于 06-17 15:08 ?2747次閱讀
    Linux系統(tǒng)中磁盤<b class='flag-5'>分區(qū)</b>與掛載詳解

    警用裝備管理系統(tǒng)DW-S304,對警用裝備的全生命周期追蹤管理.

    管理系統(tǒng)
    jf_85364936
    發(fā)布于 :2025年06月15日 09:19:54

    部隊裝備管理系統(tǒng):轉(zhuǎn)變信息化管理

    管理系統(tǒng)
    北京華盛恒輝科技
    發(fā)布于 :2025年05月08日 22:29:31
    北海市| 濉溪县| 周宁县| 璧山县| 喀喇| 城口县| 凉城县| 陈巴尔虎旗| 彝良县| 朔州市| 定安县| 凤阳县| 长兴县| 衡东县| 治多县| 金湖县| 河曲县| 随州市| 蒙城县| 漳平市| 新乡市| 增城市| 松溪县| 泗水县| 安远县| 清河县| 威信县| 合川市| 永川市| 吉安县| 延庆县| 长沙市| 嘉善县| 万源市| 海淀区| 昌乐县| 万载县| 长白| 五华县| 泰顺县| 刚察县|