随着越来越多的MCU应用程序需要复杂的算法和中间件解决方案,如何保护软件解决方案提供商开发的IP代码(如核心算法)已成为一个重要问题。
为了满足这一需求,AT32F435/437系列设计了一个安全库(sLib),用于保护重要的IP代码不被最终用户程序更改或读取。
Security library (sLib) is a defined area protected by a code in the main memory. Software solution providers store core algorithms in sLib for protection. The rest of the area can be used for secondary development by end users.
Security library includes the read-only area (SLIB_READ_ONLY) and instruction area ((SLIB_INSTRUCTION), and it can be partially or completely used as the read-only area or instruction area.
Data of the read-only area (SLIB_READ_ONLY) can be read by I-Code and D-Code buses but cannot be written.
Program codes in the instruction area (SLIB_INSTRUCTION) can only be fetched by MCU through I-Code bus (only executable), and cannot be read by reading access through DCode bus (including ISP/ICP/debug mode or boot from internal RAM), for accessing SLIB_INSTRUCTION by reading data operation will return all 0xFF.
Program codes and data in security library cannot be erased unless the correct code is keyed in. If a wrong code is keyed in, in an attempt of writing or deleting security library code, a warning message will be issued by EPPERR=1 in the FLASH_STS register.
Mass erase operation to the main Flash memory by end users will not erase the codes and data in security library.
After sLib is enabled, users can also unlock the sLib protection by writing the previously defined password in the SLIB_PWD_CLR register. After the security library protection is disabled, the MCU will erase the whole main memory, including the sLib. Therefore, the program codes are protected against leakage even if the code defined by the software solution provider is leaked.
注:具体使用方法,详见:AN0081_AT32F435_437_Security_Library_Application_Note
这是一个非常好的功能,该方法可以非常好的管控知识产权,前提条件是智能生产产线的建立和质量管控。
【1】Ardupilot开源飞控之ChibiOS简介
【2】ARTERY AT32F435
【3】ST STM32F405/415