ributed:
       1. 1/4 of the largest power of two that is greater than or equal to code size.
       2. 1/4 of the largest power of two that is greater than or equal to code size.
       3. Largest power of 2 that fits in the remaining space.
       4. Smallest power of 2 that exceeds the remaining space, minimum 32. */
    
    /* Now loop through to setup MPU protection for the code area.  */
    for (i = 0; i < TXM_MODULE_MPU_CODE_ENTRIES; i++)
    {
        /* First two MPU blocks are 1/4 of the largest power of two
           that is greater than or equal to code size.  */
        if (i < 2)
        {
            block_size = _txm_power_of_two_block_size(code_size) >> 2;
        }
        
        /* Third MPU block is the largest power of 2 that fits in the remaining space. */
        else if (i == 2)
        {
            /* Subtract (block_size*2) from code_size to calculate remaining space.  */
            code_size = code_size - (block_size << 1);
            block_size = _txm_power_of_two_block_size(code_size) >> 1;
        }
        
        /* Last MPU block is the smallest power of 2 that exceeds the remaining space, minimum 32.  */
        else
        {
            /* Calculate remaining space.  */
            code_size =  code_size - block_size;
            block_size = _txm_power_of_two_block_size(code_size);
            srd_bits = _txm_module_manager_calculate_srd_bits(block_size, code_size);
        }
        
        /* Calculate the region size information.  */
        region_size = (_txm_module_manager_region_size_get(block_size) << 1);
        
        /* Build the base address register with address, MPU region, set Valid bit.  */
        module_instance -> txm_module_instance_mpu_registers[mpu_table_index].txm_module_mpu_region_address = (code_address & ~(block_size - 1)) | mpu_table_index | 0x10;
        /* Build the attribute-size register with permissions, SRD, size, enable.  */
        module_instance -> txm_module_instance_mpu_registers[mpu_table_index].txm_module_mpu_region_attribu