I have installed IAR Embedded Workbench, FNET 1.2.2 and MQX 3.8. I'm using TWR-K60N512 + TWR_SER tower system.
The FNET bootloader (compiled with IAR) works great with a "barebone" application (always compiled with IAR): I can download the SREC firmware file through TFTP and launch the application from the bootloader with "go" command. It works.
Now I want to create an application with MQX RTOS. After adding the instruction (to use RAM for vector table)
#define MQX_ROM_VECTORS 0
in user_config.h file (under <MQX install path>\config\twrk60n512) and rebuilding MQX suite, I started from hello example (<MQX install path>\mqx\examples\hello). I can compile the sample application with IAR and it works (I can see "Hello world" message on OSBDM serial port).
Now I want to use this hello application with FNET bootloader, so avoiding the first 48KB of internal Flash where the bootloader stay. So I modified the linker configuration file (intflash.icf) and the result is attached to this message.
Moreover, after reading about a wrong behaviour of IAR, I changed the entry point (enabling the "Override default program entry" linker option, setting the "Entry symbol" to "__boot" that seems the first instruction of MQX for Cortex).
Even with this new linker file, I can start, run and debug the application alone (without the bootloader). It works... I can see the "Hello world" message.
The last step doesn't work.
I run the bootloader, download the SREC of hello MQX application through TFTP and launch it with "go" command. The starting address seems correct (0xC421), but the bootloader restarts itself. I think it isn't able to launch the application, but I don't know why.
Any help or suggestion?
I have no good solution; just confirming waht you see.
I've tried multiple boot loaders, and multiple apps; all with MQX 3.8. Using both CodeWarrior and IAR. Apps compiled with IAR fail to run from the bootloaders, while apps compiled with CodeWarrior run fine.
I'm guessing at this point, but it seems that there is something missing in the compiler specific C startup code for IAR.
My current work-around for this is to use CodeWarrior.
I have also modified the link file and I am able to download the .srec file using the bootloader. But I have noticed that on some MQX application builds, the application hangs during initialisation after a new file is bootloaded. But the odd thing is if we powercycle it the application works fine.
Did you notice anything like this ?
Also would be interested if you figured out a way to make the bootloader region non-modifiable so that the bootloader does not get corrupted in case something goes wrong in the application and modifies the bootloader region.
I think your linker file is not correct.
define symbol __ICFEDIT_region_ROM_start__ = 0x0000c420;
define symbol __ICFEDIT_region_ROM_end__ = 0x0007EFFF; /* (0x0007 ffff - boot parameters) */
define symbol __ICFEDIT_region_RAM_start__ = 0x1fff0000; /*int_ vector start here so no need to allocate additional ram */
define exported symbol __INTERNAL_FLASH_BASE = 0x0000c000;
define exported symbol __INTERNAL_FLASH_SIZE = 0x00072be0; /* 0x0007 ffff - 0x0000 c000 */
Please let me know if these are not right.