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.

想请教各位关于TMS570LC43X launchpad 关于安全测试demo中的一个函数和关于printf重定向的问题

Other Parts Discussed in Thread: CCSTUDIO

函数如下SL_SelfTest_Flash(FLASH_ECC_TEST_MODE_1BIT, TRUE, &failInfoFlash);

定义如下boolean SL_SelfTest_Flash (SL_SelfTestType testType, boolean bMode, SL_SelfTest_Result * flash_stResult);

请问这个函数实现什么功能,另外我重定向printf函数之后调用printf程序遇到上面那个函数程序就会死掉,请问是我重定向出错了吗?

其次,我printf重定向之后可以输出字符串 例如printf("welcome");可以在串口上成功显示,但输出某个变量时则无法输出,例如 printf("%d\r\n",i);则什么都不显示,这是因为我重定向错误还是因为CCS哪里没有配置好?

附上我重定向的函数:

int fputc(int ch, FILE *f)
{
sciSendByte(sciREG1, (unsigned char)ch);

while ((sciREG1->FLR & 0x4) == 4);

return (ch);
}

恳请各位不吝赐教!

  • 经过半天的摸索printf的问题解决了,大家可以参考这个网站进行printf函数的重定向http://processors.wiki.ti.com/index.php/Printf_support_for_MSP430_CCSTUDIO_compiler,但第一个问题还请各位赐教

  • Hi Jianing,

    这个是Flash的自检函数, 具体的可以参考 TMS570 SafeTI Diagnostic Library的说明:

    boolean SL_SelfTest_Flash ( SL_SelfTestType  testType,
    boolean  bMode,
    SL_SelfTest_Result *  flash_stResult 
    )

    Executes diagnostic tests on F021 Flash.

    Description:
    F021 Flash wrapper provides to verify various logic. The flash wrapper provides multiple diagnostic modes.
    Thisfunction executes the selected diagnostic mode.

    Please refer to _SL_SelfTest_Type for the values to be used for testType

    Note : Refer to Safety Manual for TMS570LS31x/21x and RM48x Hercules ARM Safety Critical Microcontrollers (section on Primary Embedded Flash and RM48x/TMS570LS31x 16/32-Bit RISC Flash Microcontroller TRM (section F021 Flash Module Controller)
    Note: For FLASH_ECC_TEST_MODE_2BIT_FAULT_INJECT the fault is injected in the subsequent read of the corrupted flash area by the application. The application must take care to restore the flash diagnostic control registers . Note: FLASH_HARD_ERROR_LIVELOCK is not supported in this release.

    Parameters
    [in] testType - Specifies the test type to execute
    [in] bMode - NOT USED
    [in] flash_stResult - Pointer to structure that is used to return the test status & results
    Note: contents of structure param1 is valid only for self-test.Not valid for Fault Injection mode.
    Returns
    TRUE if function executed successfully else FALSE

    Example Usage:

    boolean retVal;
    //Execute 1Bit test
    SL_SelfTest_Result flash_stResult;
    retVal = SL_SelfTest_Flash(FLASHECC_ECC_TEST_MODE_1BIT, TRUE, &flash_stResult);
    Entry Mode:
    Any privilege mode
    Exit Mode:
    Same as entry
    See also:
    Type:_SL_SelfTest_Type
    Profiling Information of Tests:
    TestTypeProfiling Time in us
    FLASH_ECC_ADDR_TAG_REG_MODE 8.437
    FLASH_ECC_TEST_MODE_1BIT 7.3605
    FLASH_ECC_TEST_MODE_2BIT 13.3885 

    谢谢!

x 出现错误。请重试或与管理员联系。