This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

[参考译文] CCS/LAUNCHXL-CC1352R1:向闪存写入默认值。

Guru**** 2999690 points
请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/tools/code-composer-studio-group/ccs/f/code-composer-studio-forum/925991/ccs-launchxl-cc1352r1-writing-default-value-to-flash

器件型号:LAUNCHXL-CC1352R1

工具/软件:Code Composer Studio

你好!

环境:

CC1352R1硬件版本 B
CCS 10.
GCC 9.2.1
SDK 4.20.00.35

问题:

在我的项目中、我使用 NVS 驱动程序来写入和读取闪存中的数据。 此外、我还有一组默认值的数据、我希望将其写入同一存储器区域、但我希望在刷写程序时仅执行一次。

我找到了 TI 编译器的一个选项:#pragma LOCATION (flashData、NVS_REGASE_BASE);但它不适用于 GCC 编译器。 我该怎么做?

Robert。

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    Robert、

    从 NVS 驱动程序文档中、可从此处获取:

    https://software-dl.ti.com/simplelink/esd/simplelink_cc13x2_26x2_sdk/3.40.00.02/exports/docs/tidrivers/doxygen/html/struct_n_v_s_c_c26_x_x___h_w_attrs.html

    代码文档向您展示了如何为 NVS 设置编译器参数、每个编译器上的这些参数不同。

    #elif defined (__GNU__)
    //
    //将闪存缓冲区放置在在 gcc 链接器文件中创建的.NVS 段中。
    //.NVS 段强制对齐扇区边界,但可以
    //放置在闪存中的任何位置。 如果需要、
    可以通过更改 gcc 链接器文件中的以下内容来将.NVS 段设置为//固定地址:
    //
    //.NVS (fixed_flash_ADDR)(NoLoad):at (fixed_flash_ADDR){
    // *(.NVS)
    //}> region_text
    //
    __attribute__((section (".NVS"))
    char flashBuf[REGionIZE];
    #endif 

    此致、

    Daniel