Sorry for taking so long; I had hoped to have a final solution before now.
I copied the MQX initialization structure to main.c and removed the const keyword so that the structure would end up in RAM:
MQX_INITIALIZATION_STRUCT MQX_init_struct =
{
/* PROCESSOR_NUMBER */ BSP_DEFAULT_PROCESSOR_NUMBER,
/* START_OF_KERNEL_MEMORY */ BSP_DEFAULT_START_OF_KERNEL_MEMORY,
/* END_OF_KERNEL_MEMORY */ BSP_DEFAULT_END_OF_KERNEL_MEMORY,
/* INTERRUPT_STACK_SIZE */ BSP_DEFAULT_INTERRUPT_STACK_SIZE,
....
This allows me to change the default end of kernel memory in the beginning of main.c before I start MQX with
_mqx( (MQX_INITIALIZATION_STRUCT_PTR) &MQX_init_struct );
But since the original linker .lcf file had the boot stack located near the end of the original MQX space, I had to delete the original bstack segment and add my own stack before the beginning of the MQX space:
.main_application_bss :
{
. =
ALIGN(0x10);
__START_SBSS = .;
*(.sbss)
*(SCOMMON)
__END_SBSS = .;
__START_BSS = .;
*(.bss)
*(COMMON)
__END_BSS = .;
. =
ALIGN(16);
_stack_end = .;
.=.+0x200;
_stack_addr = .;
__SP_INIT = .;
__BOOT_STACK_ADDRESS = .;
} >> ram
.kernel_data :
#AT(ADDR(.main_application_bss) + SIZEOF(.main_application_bss))
{
__KERNEL_DATA_START =
ALIGN(0x10);
}
...
I had tried to put the boot stack at the beginning of the MQX space, but when MQX starts it continues to use the boot stack for a while before setting up its own stack; in the process of setting up its space, MQX was apparently overwriting the boot stack.
I will eventually look into putting the boot stack at beginning of the MQX space, adjust the end of the MQX space as above, and then set the stack pointer to the end of the shortened MQX space just before starting MQX; that way I will not have wasted RAM space on a boot stack that is never used after MQX starts.