Complete the code to enable the MPU for task isolation in an RTOS.
MPU->CTRL = [1] | MPU_CTRL_PRIVDEFENA_Msk;The MPU must be enabled using the MPU_CTRL_ENABLE_Msk flag to activate memory protection for tasks.
Complete the code to configure an MPU region base address for a task.
MPU->RNR = [1]; // Select region number
MPU->RBAR = task_base_address;Region number 0 is commonly used for the first MPU region configuration.
Fix the error in setting the MPU region size for task isolation.
MPU->RASR = ([1] << MPU_RASR_SIZE_Pos) | MPU_RASR_ENABLE_Msk;The size field in the MPU_RASR register uses the value 7 to represent a 256-byte region (2^(7+1) = 256 bytes).
Fill both blanks to set the MPU region attributes for privileged read/write (unprivileged no-access) and execute never.
MPU->RASR = ([1] << MPU_RASR_AP_Pos) | ([2] << MPU_RASR_XN_Pos) | MPU_RASR_ENABLE_Msk;
Access permission 1 (AP=001) allows read/write access from privileged mode and no access from unprivileged mode. Execute never (XN) bit set to 1 disables execution.
Fill all three blanks to create a dictionary comprehension that maps task names to their MPU region sizes if the size is greater than 128 bytes.
region_sizes = {{'{'}}[1]: [2] for [1], [2] in tasks.items() if [2] > 128{{'}}'}}The comprehension iterates over task and size from the dictionary. It maps each task to its size if the size is greater than 128 bytes.
