1
0
mirror of https://github.com/armink/EasyLogger.git synced 2025-01-31 21:42:53 +08:00
EasyLogger/demo/os/nuttx-spiflash

Nuttx SPI Flash demo


1<A1><A2><BC><F2><BD><E9>

ͨ<B9><FD> apps/examples/easylogger/elog_main.c <20><> test_elog() <20><><B7><BD><B7><A8><C0><B4><B2><E2><CA><D4>־<D5><D6BE><B5><C4><CA><E4><B3><F6>Ĭ<AC>Ͽ<C8><CFBF><AA><C6><F4><C1><D2><ECB2BD><CA><E4>ģʽ<C4A3><CABD><A3>û<D3><C3BB><A7><BF>Խ<D2><D4BD><D3><C8>ն<D6><D5B6><CB><C0><B4><BF><D8><D6><C6>־<D5><D6BE><B5><C4><CA><E4><B3><F6><D3><EB><B9><FD><C2><CB><C6><F7><B5><C4><C9>á<D6> test_env() <20><><B7><BD><B7><A8><C0><B4>ʾ<DD><CABE><BB><B7><BE><B3><B1><E4><C1>Ķ<B5>ȡ<C1><C8A1><BC>޸Ĺ<DEB8><C4B9>ܣ<C4>ÿ<AC><C3BF>ϵͳ<CFB5><CDB3><C6><F4><B6><AF><B2>ҳ<C7>ʼ<F5><CABC>EasyFlash<73>ɹ<B3><C9B9><A6><BA><F3><BB><E1><B5>ø÷<C3B8><C3B7><BD><B7><A8>

  • ƽ̨<BB><B7><BE><B3><A3><BA>NuttX-12.0.0<A3><A8>NuttX-10.X.X<><58>Ҫ<E8>޸<D0>Makefile<6C><65><C0><EF>include<64><65><B5><C4><C5>÷<D6><C3B7><BD><B7><A8>
  • Ӳ<BC><FE><BB><B7><BE><B3><A3><BA>STM32F103<A3><A8>Nuttx<B5><C4>apps<B2><E3><CE><DE><CA><D3>Ӳ<BC><FE>ƽ̨<A3><A9>
  • Flash<BB><B7><BE><B3><A3><BA>W25QXX<A3><A8>Nuttx֧<B3>ֵ<C4>SPI Flash<73><68><A3><AC><C7><EB><B2><E9>nuttx/drivers/mtd<B5><C4><C5><E4><D6><C3><CE>ļ<FE><A3><A9>

2<A1><A2>ʹ<D3>÷<BD><B7><A8>

<B1><E0><D2><EB><BA><CD><CF><C2><D4><D8><CD><EA><B3>ɺ<F3><A3><AC><D4><DA>nsh<BF><D8><D6><C6>̨<CA><E4><C8><EB>elog<BB>س<B5><C6><F4><B6><AF><BD>ű<BE><B2><A2><B9>۲<EC><CA><E4><B3><F6><BD><E1><B9><FB><A1><A3>

ElogNuttxSpiFlashDemo

3<A1><A2><CE>ļ<FE><A3><A8><BC>У<A9>˵<C3><F7>

Դ<CE>ļ<FE><A3><A8><BC>У<A9> <C3><E8><CA><F6>
apps nuttx-appsӦ<73>ò<D3>Ŀ¼
apps/examples/ nuttxӦ<D3>ò<E3>ʾ<C0><FD><B4><FA><C2><EB>Ŀ¼
apps/examples/easylogger/elog_main.c Easylogger<BA><CD>Easyflash<B5><C4>Example Demo<6D><6F><B4><FA>
apps/system/ nuttxӦ<D3>ò<E3>ϵͳ<BF><E2>Ŀ¼
apps/system/easylogger/inc/elog_cfg.h Easylogger<C5><E4><D6><C3><CE>ļ<FE>
apps/system/easylogger/port/elog_port.c Easylogger<D2><C6>ֲ<B2>ο<BC><CE>ļ<FE>
apps/system/easyflash/inc/ef_cfg.h Easyflash<C5><E4><D6><C3><CE>ļ<FE>
apps/system/easyflash/port/ef_port.c Easyflash<D2><C6>ֲ<B2>ο<BC><CE>ļ<FE>

4<A1><A2><C6><E4><CB><FB>˵<C3><F7>

4.1<A1><A2><D2><C6>ֲ˵<C3><F7>

1<A1><A2><B0>Ѹ<F9>Ŀ¼EasyLogger/<C0><EF><B5><C4><D2><D4><CF><C2><D5><E2>Щ<CE>ļ<FE><BF><BD><B1><B4><B5><BD>ָ<B6><A8>λ<D6>ã<BB>

cd EasyLogger/
cp easylogger/inc/elog.h demo/os/nuttx-spiflash/apps/system/easylogger/inc
cp easylogger/plugins/flash/elog_flash.* demo/os/nuttx-spiflash/apps/system/easylogger/plugins/flash/
cp -R easylogger/src/ demo/os/nuttx-spiflash/apps/system/easylogger/

2<A1><A2><BF><BD><B1><B4>apps<CF><C2><CB><F9><D3><D0>Ŀ¼<B8><B2><B8>ǵ<BD>nuttx<B5><C4>appsĿ¼<CF>¡<A3>

3<A1><A2>nuttxĿ¼<D6><D0><C7><E5><B3><FD><B2><A2><B8><FC><D0><C2>appsĿ¼<BD><BB><BA><B4>

make apps_distclean
make menuconfig

4<A1><A2>make menuconfigѡ<D4><F1><D2><D4><CF><C2><C5><E4><D6>ã<AC><B4><F2><BF><AA>Easylogger Demo Example<6C><65>

CONFIG_EXAMPLES_EASYLOGGER=y

<BD><AB><D7>Զ<AF><B4><F2><BF><AA><C5><E4><D6><C3>

CONFIG_MTD_W25=y

5<A1><A2><CC><ED><BC><D3>mtd ioctl<74><6C>ָ<C4><D6B8>ID<49><44><A3><BA><A3><A8><C8><E7><B9>ر<B9>Easyflash<73><68><B9>ܿ<C4><DCBF><C9>ʡ<D4>ԣ<C2>

  • <B4><F2><BF><AA>nuttx/include/nuttx/mtd/mtd.h<CE>ļ<FE><A3><AC><B2><A2><CC><ED><BC>ӣ<BA>
#define MTDIOC_GETMTDDEV  _MTDIOC(0x000c)

6<A1><A2><B1><A9>¶w25<B5><C4>mtd<C9><BD>ڵ㣺<A3><A8><C8><E7><B9><FB><B9>ر<D5>Easyflash<B9><A6><C4>ܿ<C9><D2><D4>ʡ<C2>ԣ<A9>

  • <B4><F2><BF><AA>nuttx/drivers/mtd/w25.c<CE>ļ<FE>
  • <CC><ED><BC>ӱ<E4><C1><BF><C9><F9><C3><F7><A3><BA>
static FAR struct mtd_dev_s *mtd_w25;
  • <D5>ҵ<BD>w25_ioctl<BA><AF><CA><FD><A3><AC><D4><DA>switch (cmd)<C0><EF><C3><E6><CC><ED><BC>ӣ<BA>
      case MTDIOC_GETMTDDEV:{
          FAR struct mtd_dev_s **mtd =
            (FAR struct mtd_dev_s *)((uintptr_t)arg);
          DEBUGASSERT(*mtd != NULL);
          *mtd = mtd_w25;
          ret = OK;
      }break;
  • <D5>ҵ<BD>w25_initialize<BA><AF><CA><FD><A3><AC><D4><DA>ret = w25_readid(priv)<B6><C1>ID<D5><FD>ȷ<B7><B5><BB>ص<C4><C0><A8><BA><C5><C0><EF><CC><ED><BC>ӣ<BA>
mtd_w25=&priv->mtd;

7<A1><A2><B1><E0><D2><EB>make -j4<A3><AC><CF><C2><D4>ص<BD><B0><E5><D7>Ӻ<F3><A3><AC><D4><DA>NSH<BF><D8><D6><C6>̨<CA><E4><C8><EB>elog<A3><AC><BC><B4><BF>ɲ鿴<CA><E4><B3><F6><BD><E1><B9><FB><A1><A3>