MQX K60N512 ethernet bootloader using FNET

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

MQX K60N512 ethernet bootloader using FNET

Jump to solution
2,821 Views
nikhilsarnaik
Contributor III

Hi guys,

I am using the FNET 1.0 bootloader to download the file for K60N512 via tftp.

I followed the steps mentioned in the AN4367. I am able to download the file correctly as shown by the log screen.

Capture1.PNG

but when i enter command go and reboot the controller keep getting interrupted and default_irs 3 gets called continuosly. Has anyone seen something like this before:

Capture2.PNG

Thanks in advance

Nikhil


0 Kudos
1 Solution
1,769 Views
UK_CF_FAE
NXP Employee
NXP Employee

Hi Nikhil,

That ISR tells me that the project has an incorrect entry point... when the bootloader passes control to the application it does not start at the correct address. I had the same experience when developing MQX applications with AN4367. By the way, I was using IAR development environment. Here is my findings, and fixes....

Ethernet Bootloader MQX example

An MQX project needs to have user_config,h modified so that it uses RAM vectors... FNET is using the default vector table at 0x0000_0000.

In user_config.h for the BSP, make the following additions:

#DEFINE MQX_ROM_VECTORS 0

Build the libs.

Take an existing MQX example program. It needs some modifications.
1) Needs a new linker file - see intflash_fnet.icf in the project
2) Entry point needs to be fixed: MQX begins execution in cortex.boot.s at the symbol __boot, which is a public symbol. In IAR project options [Alt-F7] Linker | Library view, Override default program entry and specify symbol __boot
3) Not essential, but in IAR project options [Alt-F7] Output Converter | Output view, give the output SREC a helpful name, eg <projectname>_fnet.srec

Build the project. You can modify the BUILD #define to program varying delays into the LED blinking to test you've actually changed the image.


RUNNING THE EXAMPLE
===================

Build FNET bootloader twrk60n512_boot.eww in the FNET 1.0.0 installation. Doesn't need any fixing up. Ethernet project, so TWR-K60N512 uses clock from TWR-SER. Flash image. Console output on 115,200 8N1 as it boots, so run HyperTerminal.

Run tftpd32.exe.
Copy the SREC from step 3 above into short path on harddrive, and point tftpd32.exe to that path. Note IP address assigned to tftpd32.exe displayed in window, in my example is was .10

In HyperTerminal, get IP address assigned to board. Use command sequence:


Parameters loaded from Flash.
************************************************
FNET Bootloader
************************************************
FNET TCP/IP Stack for MK60N512
Version 1.0.0
Built Apr  3 2012 at 15:23:51 by IAR
Copyright 2005-2011 by Freescale Semiconductor
GNU LGPLv3
************************************************
Interface        : eth0
IP address       : 192.168.1.22 (set manually)
Subnet mask      : 255.255.255.0
Gateway          : 192.168.0.1
MAC address      : 00:04:9F:15:23:57
Link status      : connected
TX Packets       : 4
RX Packets       : 0
Free Heap        : 14144
DHCP client      : disabled
TFTP server      : disabled
Enter 'help' for command list.
************************************************
Startup script: tftps
************************************************
  TFTP server (192.168.1.22) started.
************************************************
BOOT> dhcp <<<<<<<<<<<<<<<<<<<<<<<<<<< Type this
Press [Ctr+C] to cancel.
Sending DHCP discover...
************************************************
DHCP has updated/renewed parameters:
************************************************
Interface    : eth0
IP address   : 192.168.0.11
Subnet mask  : 255.255.255.0
Gateway      : 192.168.0.1
BOOT> erase all <<<<<<<<<<<<<<<<<<<<<<<<<<< Type this
Erasing...
0x00000000 to 0x0000BFFF skipped
0x0000C000 to 0x0007F7FF erased
0x0007F800 to 0x0007FFFF skipped
BOOT> tftp blinky_fnet.srec 192.168.0.10 <<<<<<<<<<<<<<<<< Type this
Press [Ctr+C] to cancel.
TFTP downloading 'blinky_fnet.srec' (srec) from 192.168.0.10: |
Entry point set to 0x0000C46D
TFTP completed (121654 bytes)
BOOT> set go 0xc421
go      : 0xC421
BOOT> save
Parameters saved
BOOT> go
Initialize IO
LED1_TASK created
LED2_TASK created
LED3_TASK created
LED4_TASK created
led1 task
led2 task
led3 task
led4 task
POWER CYCLE BOARD

View solution in original post

0 Kudos
5 Replies
1,770 Views
UK_CF_FAE
NXP Employee
NXP Employee

Hi Nikhil,

That ISR tells me that the project has an incorrect entry point... when the bootloader passes control to the application it does not start at the correct address. I had the same experience when developing MQX applications with AN4367. By the way, I was using IAR development environment. Here is my findings, and fixes....

Ethernet Bootloader MQX example

An MQX project needs to have user_config,h modified so that it uses RAM vectors... FNET is using the default vector table at 0x0000_0000.

In user_config.h for the BSP, make the following additions:

#DEFINE MQX_ROM_VECTORS 0

Build the libs.

Take an existing MQX example program. It needs some modifications.
1) Needs a new linker file - see intflash_fnet.icf in the project
2) Entry point needs to be fixed: MQX begins execution in cortex.boot.s at the symbol __boot, which is a public symbol. In IAR project options [Alt-F7] Linker | Library view, Override default program entry and specify symbol __boot
3) Not essential, but in IAR project options [Alt-F7] Output Converter | Output view, give the output SREC a helpful name, eg <projectname>_fnet.srec

Build the project. You can modify the BUILD #define to program varying delays into the LED blinking to test you've actually changed the image.


RUNNING THE EXAMPLE
===================

Build FNET bootloader twrk60n512_boot.eww in the FNET 1.0.0 installation. Doesn't need any fixing up. Ethernet project, so TWR-K60N512 uses clock from TWR-SER. Flash image. Console output on 115,200 8N1 as it boots, so run HyperTerminal.

Run tftpd32.exe.
Copy the SREC from step 3 above into short path on harddrive, and point tftpd32.exe to that path. Note IP address assigned to tftpd32.exe displayed in window, in my example is was .10

In HyperTerminal, get IP address assigned to board. Use command sequence:


Parameters loaded from Flash.
************************************************
FNET Bootloader
************************************************
FNET TCP/IP Stack for MK60N512
Version 1.0.0
Built Apr  3 2012 at 15:23:51 by IAR
Copyright 2005-2011 by Freescale Semiconductor
GNU LGPLv3
************************************************
Interface        : eth0
IP address       : 192.168.1.22 (set manually)
Subnet mask      : 255.255.255.0
Gateway          : 192.168.0.1
MAC address      : 00:04:9F:15:23:57
Link status      : connected
TX Packets       : 4
RX Packets       : 0
Free Heap        : 14144
DHCP client      : disabled
TFTP server      : disabled
Enter 'help' for command list.
************************************************
Startup script: tftps
************************************************
  TFTP server (192.168.1.22) started.
************************************************
BOOT> dhcp <<<<<<<<<<<<<<<<<<<<<<<<<<< Type this
Press [Ctr+C] to cancel.
Sending DHCP discover...
************************************************
DHCP has updated/renewed parameters:
************************************************
Interface    : eth0
IP address   : 192.168.0.11
Subnet mask  : 255.255.255.0
Gateway      : 192.168.0.1
BOOT> erase all <<<<<<<<<<<<<<<<<<<<<<<<<<< Type this
Erasing...
0x00000000 to 0x0000BFFF skipped
0x0000C000 to 0x0007F7FF erased
0x0007F800 to 0x0007FFFF skipped
BOOT> tftp blinky_fnet.srec 192.168.0.10 <<<<<<<<<<<<<<<<< Type this
Press [Ctr+C] to cancel.
TFTP downloading 'blinky_fnet.srec' (srec) from 192.168.0.10: |
Entry point set to 0x0000C46D
TFTP completed (121654 bytes)
BOOT> set go 0xc421
go      : 0xC421
BOOT> save
Parameters saved
BOOT> go
Initialize IO
LED1_TASK created
LED2_TASK created
LED3_TASK created
LED4_TASK created
led1 task
led2 task
led3 task
led4 task
POWER CYCLE BOARD

0 Kudos
1,393 Views
stefano_conegia
Contributor I

Hi,

I am involved in board testing with this CPU but now, we have to use the MK60DN512ZVLQ10 instead of MK60DN512VLQ10. The issue is that the chip with version "Z", is not working and I see with debug that it jumps forever at the "default_isr" function ...

I am sure that the bootloader works fine and I can see the point where is the final Jump to the app code.

From the bootloader, I see the jump instruction:

(( void(*)() )FNET_CPU_INSTRUCTION_ADDR(address))(); /* Jump. */

Where the macro is: ((address) | 0x1)

Is this code correct for both CPUs?

Could you help me?

PS: I am using MQX41

Thanks!

Stefano

0 Kudos
1,769 Views
nikhilsarnaik
Contributor III

Hello Mark,

That fix did work like charm, Although I did not do the modification 2, but setting the correct entry point in the intflash.icf file as per the attached linker file did fix my issue. Probably we need to include the example linker file that you attached into the AN4367. Anyways  I will try doing the modification 2 sometime later to see what good/bad effects it has sometime later.

Thanks for the help.

Nikhil Sarnaik

0 Kudos
1,769 Views
nikhilsarnaik
Contributor III

PS:

I did edit the intflash.icf file as per the AN4367 to generate the .srec file for downlaoding via tftp. But the document only shows modification in IAR for K60 bareboard application and my application is based on MQX3.8. I am not sure if that makes any difference.

Any light on the topic would be much helpful and appreciated.

Thanks

Nikhil

0 Kudos
1,769 Views
c0170
Senior Contributor III

Hello Nikhil Sarnaik,

does the application work by itself? Can you also share your "new" linker command file, provide what you have done so far.

Regards.

c0170

0 Kudos