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.

RTOS / RM48L952:RTOS / RM48L952: Memory Protection Unit

Part Number: RM48L952
Other Parts Discussed in Thread: HALCOGEN

Tool/software: TI-RTOS

Good day!

The project on the microcontroller RM48L952, working environment - FreeRTOS, Code Composer Studio 8.3, HALCoGen 04.07.01.

There is a need in the project to create several global arrays with limited access: reading array elements for any task, and writing for only one task. This is to protect arrays from unauthorized recording.

With the prvSetupDefaultMPU () procedure (os_port.c file), the entire region of RAM is configured for privileged read and write access and non-privileged read-only access. Apparently, this is just what you need.

I created a test project with two tasks: one task with the portPRIVILEGE_BIT flag, the other without this flag. I thought that the first task could write and read global arrays, and the second only read. But when performing the test, I made sure that both tasks are written to the global array. Those. protect arrays from unauthorized writing failed.

Is there a solution to this problem?

Sincerely, Talgat Burganov.

  • Hello,
    I am sorry for the late reply.
    Is it possible to attach your test project so we can debug?


    Best regards,
    Miro
  • The program was tested on the basis of the RM46 Hercules Development KIT (HDK), 
    processor - RM46L852ZWT. 
    CCS 8.3.0.
    //=============================================
    unsigned int gTest[10];
    void vTaskBlink(void *pvParameters)
    {
      // Block for 500ms.
      const TickType_t xDelay = 500 / portTICK_PERIOD_MS;
      unsigned int i;
      while (1) {
    for (i=1;i<10;i++) gTest[i] = i;
        gioToggleBit(hetPORT1, PIN_HET_31);   // Top
    gioSetBit(hetPORT1, PIN_HET_0, 0);    // Off Led RightTop
        vTaskDelay( xDelay );
      }                                       // while (1) {
    }
    void vTask2(void *pvParameters)
    {
      const TickType_t xDelay = 3000 / portTICK_PERIOD_MS;
      unsigned int i;
      while (1) {
    gioSetBit(hetPORT1, PIN_HET_0, 1);    // On Led RightTop
       for (i=1;i<10;i++)  gTest[i] = 10 + i;
        vTaskDelay( xDelay );
      }                                       // while (1) {
    }
    void appl_Main(void)
    {
      hetInit();
      gioInit();
      gioSetDirection(hetPORT1, 0xFFFFFFFF);
      _enable_IRQ();
      if (xTaskCreate(vTaskBlink, (const char *)"TaskBlink", 
                      configMINIMAL_STACK_SIZE, NULL, 
                      3 | portPRIVILEGE_BIT, 
                      NULL) != pdTRUE)
      {
        // Task could not be created
        while (1);
      }
      if (xTaskCreate(vTask2, (const char *)"Task2", 
                      configMINIMAL_STACK_SIZE, NULL, 
                      2, NULL) != pdTRUE)
      {
        // Task could not be created
        while (1);
      }
      vTaskStartScheduler();
      while(1);
    }
    //=============================================