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.

[参考译文] SK-AM64B:ADC 中的防火墙和 R5f 和 Linux 中的 SPI

Guru**** 2474700 points
Other Parts Discussed in Thread: SYSCONFIG

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

https://e2e.ti.com/support/processors-group/processors/f/processors-forum/1453461/sk-am64b-firewall-from-the-adc-and-spi-from-r5f-and-linux

器件型号:SK-AM64B
主题中讨论的其他器件:SysConfig

工具与软件:

你好  

我有一个由 Linux 引导的 R5f 代码。 我需要保护 ADC 和 SPI 以便 Linux 不能读取数据。

我认为最好的解决方案是在 SysConfig 中使用防火墙。  

当我启用附加的此 SysConfig 时、整个系统将停止工作。 我不知道我做了什么错。 启用 firewal 后、应用程序停止运行。

  

/**
 * These arguments were used when this file was generated. They will be automatically applied on subsequent loads
 * via the GUI or CLI. Run CLI with '--help' for additional information on how to override these arguments.
 * @cliArgs --device "AM64x" --package "ALV" --part "Default" --context "r5fss0-0" --product "MCU_PLUS_SDK_AM64x@09.00.00"
 * @versions {"tool":"1.17.0+3128"}
 */

/**
 * Import the modules used in this configuration.
 */
const adc        = scripting.addModule("/drivers/adc/adc", {}, false);
const adc1       = adc.addInstance();
const firewall   = scripting.addModule("/drivers/firewall/firewall", {}, false);
const firewall1  = firewall.addInstance();
const gpio       = scripting.addModule("/drivers/gpio/gpio", {}, false);
const gpio1      = gpio.addInstance();
const gpio2      = gpio.addInstance();
const ipc        = scripting.addModule("/drivers/ipc/ipc");
const mcspi      = scripting.addModule("/drivers/mcspi/mcspi", {}, false);
const mcspi1     = mcspi.addInstance();
const udma       = scripting.addModule("/drivers/udma/udma", {}, false);
const udma1      = udma.addInstance();
const debug_log  = scripting.addModule("/kernel/dpl/debug_log");
const mpu_armv7  = scripting.addModule("/kernel/dpl/mpu_armv7", {}, false);
const mpu_armv71 = mpu_armv7.addInstance();
const mpu_armv72 = mpu_armv7.addInstance();
const mpu_armv73 = mpu_armv7.addInstance();
const mpu_armv74 = mpu_armv7.addInstance();
const mpu_armv75 = mpu_armv7.addInstance();
const mpu_armv76 = mpu_armv7.addInstance();
const mpu_armv77 = mpu_armv7.addInstance();
const timer      = scripting.addModule("/kernel/dpl/timer", {}, false);
const timer1     = timer.addInstance();

/**
 * Write custom configuration values to the imported modules.
 */
adc1.$name                  = "CONFIG_ADC0";
adc1.ADC.$assign            = "ADC0";
adc1.ADC.AIN0.$assign       = "ADC0_AIN0";
adc1.ADC.AIN1.$assign       = "ADC0_AIN1";
adc1.ADC.AIN2.$assign       = "ADC0_AIN2";
adc1.ADC.AIN3.$used         = false;
adc1.ADC.AIN4.$used         = false;
adc1.ADC.AIN5.$used         = false;
adc1.ADC.AIN6.$used         = false;
adc1.ADC.AIN7.$used         = false;
adc1.ADC.EXT_TRIGGER0.$used = false;
adc1.ADC.EXT_TRIGGER1.$used = false;

firewall1.$name               = "CONFIG_FIREWALL0";
firewall1.regCfg.create(2);
firewall1.regCfg[0].$name     = "FWL_REG_CFG0";
firewall1.regCfg[0].regIndex  = 1;
firewall1.regCfg[0].instName  = "ADC0";
firewall1.regCfg[0].interName = "FIFO";
firewall1.regCfg[0].fwlPriv1  = "MAIN_0_R5_0_SECURE";
firewall1.regCfg[1].$name     = "FWL_REG_CFG1";
firewall1.regCfg[1].regIndex  = 2;
firewall1.regCfg[1].instName  = "MCSPI0";
firewall1.regCfg[1].interName = "CFG";
firewall1.regCfg[1].fwlPriv1  = "MAIN_0_R5_0_SECURE";

gpio1.pinDir               = "OUTPUT";
gpio1.$name                = "DIS_THYR_STM32";
gpio1.GPIO.gpioPin.$assign = "I2C1_SCL";

gpio2.pinDir               = "OUTPUT";
gpio2.$name                = "SIT_DIS_VCC_STM32";
gpio2.GPIO.gpioPin.$assign = "I2C1_SDA";

ipc.enableLinuxIpc = true;

mcspi1.$name                       = "CONFIG_MCSPI0";
mcspi1.intrEnable                  = "DMA";
mcspi1.inputSelect                 = "0";
mcspi1.dpe0                        = "DISABLE";
mcspi1.dpe1                        = "ENABLE";
mcspi1.SPI.$assign                 = "SPI0";
mcspi1.SPI.CLK.$assign             = "SPI0_CLK";
mcspi1.SPI.D0.$assign              = "SPI0_D0";
mcspi1.SPI.D1.$assign              = "SPI0_D1";
mcspi1.mcspiChannel[0].$name       = "CONFIG_MCSPI_CH0";
mcspi1.mcspiChannel[0].frameFormat = "POL0_PHA1";
mcspi1.mcspiChannel[0].advanced    = true;
mcspi1.mcspiChannel[0].bitRate     = 7000000;
mcspi1.mcspiChannel[0].CSn.$assign = "SPI0_CS0";

udma1.$name       = "CONFIG_UDMA0";
mcspi1.udmaDriver = udma1;

debug_log.enableLogZoneInfo = true;
debug_log.enableMemLog      = true;

mpu_armv71.$name             = "CONFIG_MPU_REGION0";
mpu_armv71.size              = 31;
mpu_armv71.attributes        = "Device";
mpu_armv71.accessPermissions = "Supervisor RD+WR, User RD";
mpu_armv71.allowExecute      = false;

mpu_armv72.$name             = "CONFIG_MPU_REGION1";
mpu_armv72.size              = 15;
mpu_armv72.accessPermissions = "Supervisor RD+WR, User RD";

mpu_armv73.$name             = "CONFIG_MPU_REGION2";
mpu_armv73.baseAddr          = 0x41010000;
mpu_armv73.size              = 15;
mpu_armv73.accessPermissions = "Supervisor RD+WR, User RD";

mpu_armv74.$name             = "CONFIG_MPU_REGION3";
mpu_armv74.baseAddr          = 0x70000000;
mpu_armv74.size              = 21;
mpu_armv74.accessPermissions = "Supervisor RD+WR, User RD";

mpu_armv75.$name        = "CONFIG_MPU_REGION4";
mpu_armv75.attributes   = "NonCached";
mpu_armv75.allowExecute = false;
mpu_armv75.size         = 16;
mpu_armv75.baseAddr     = 0x8D000000;

mpu_armv76.$name    = "CONFIG_MPU_REGION5";
mpu_armv76.baseAddr = 0x80000000;
mpu_armv76.size     = 31;

mpu_armv77.$name        = "CONFIG_MPU_REGION6";
mpu_armv77.size         = 20;
mpu_armv77.baseAddr     = 0x8E000000;
mpu_armv77.attributes   = "NonCached";
mpu_armv77.allowExecute = false;

timer1.$name         = "CONFIG_TIMER0";
timer1.startTimer    = true;
timer1.intrPriority  = 2;
timer1.timerCallback = "schedulerTimerCallback";

/**
 * Pinmux solution for unlocked pins/peripherals. This ensures that minor changes to the automatic solver in a future
 * version of the tool will not impact the pinmux you originally saw.  These lines can be completely deleted in order to
 * re-solve from scratch.
 */
gpio1.GPIO.$suggestSolution   = "GPIO1";
gpio2.GPIO.$suggestSolution   = "GPIO1";
timer1.TIMER.$suggestSolution = "DMTIMER0";