L1 LLINK based Boot question

Technical discussions around xCORE processors (e.g. xcore-200 & xcore.ai).
User avatar
Folknology
XCore Legend
Posts: 1274
Joined: Thu Dec 10, 2009 10:20 pm

L1 LLINK based Boot question

Post by Folknology »

Ok having read the various documentation around the master slave LLINK booting it appears that for dev tools supported booting out of the box I need the slave L1 to boot over LLINK B to the master which has SPI flash.

Unfortunately in this particular case LLINK B is not available to me on either L1s, (they are dedicated to other interfaces that I cannot change). Thus I will need to Boot over LLINK A. So my question is how does one do this?

1) I presume I will need to write custom BOOT code and blow it into OTP?
2) Will I have to write such code and blow OTP on both L1s?
3) What else do I need to change?
4) What would that custom code look like , are their any examples or guidelines?
5) Anyone done this before?

Help, pointers or guidance appreciated

regards
Al


User avatar
Woody
XCore Addict
Posts: 165
Joined: Wed Feb 10, 2010 2:32 pm

Post by Woody »

You're right that you need to put code in the OTP, but only into the slave's OTP.

Your OTP slave code needs to:
1. Enable XlinkA in 2wire mode, with slow enough inter symbol delays to work. (The boot code has 1us inter symbol delays by default I think).
2. Jump to the boot code at just the right point where it has enabled xlinkB (& the 4 dedicated xlinks). I think it then gets a channel end (0) and tries to boot using the code sent to it on that channelend.

Your code running on the master L1 does the same as it would if the slave were booting down xlink B.

I've not done this myself before, so keep us posted with how you get on.
m_y
Experienced Member
Posts: 69
Joined: Mon May 17, 2010 10:19 am

Post by m_y »

Folknology wrote:1) I presume I will need to write custom BOOT code and blow it into OTP?
Yes.
Folknology wrote:2) Will I have to write such code and blow OTP on both L1s?
No. Only on the slave. The master-side code is part of the application, not the boot sequence, so you can change the links there without touching the OTP.
Folknology wrote:3) What else do I need to change?
That should be all.
Folknology wrote:4) What would that custom code look like , are their any examples or guidelines
I don't have a worked example to hand.

There are two choices - either you write a full custom boot loader or perform some gymnastics with the boot ROM. I'd recommend the latter.

Essentially you need to write a program which enables only the approriate xlinks then jumps back into the boot ROM at 0xffffc0a2. Your program can't assume that SP will be set up and it must jump back into the boot ROM with DP and CP unchanged.

If you disassemble the boot ROM from 0xffffc072 to 0xffffc0a0 you can see how the boot ROM does the link enabling. This would be a good thing to copy and modify.
Folknology wrote:5) Anyone done this before?
Not exactly this but something very similar for the XK-1 board.
User avatar
Folknology
XCore Legend
Posts: 1274
Joined: Thu Dec 10, 2009 10:20 pm

Post by Folknology »

Thanks guys for the quick response, although I probably won't be doing the boot loader before my vacation, I do need to get the hardware design off for prototyping before then. I should now be able to finalise the design leaving only the testing and boot loader.

I will probably revisit this thread when I get around to working on the boot loader, it will be my first low level/asm so will probably be asking a few more questions!

regards
Al
User avatar
snowman
Member
Posts: 13
Joined: Fri Dec 11, 2009 10:51 am

Post by snowman »

Attached code has been succesfully used to initialise a link and send/receive data.

Example sender (node ID 0):

Code: Select all

  set_node_id(0);
  link_enable();
  mswait(50);
  link_reset();
  link_hello();
  mswait(100);
  for (int i = 0; i < 100000; i++) {
    send_msg(0x80000102, "chocolate", 10);
  }
Example receiver (node ID 8000):

Code: Select all

  int c;
  set_node_id(0x8000);
  c = chan_alloc();
  assert(c == 0x80000102);   // channel 0 has been allocated by Boot ROM (boot from link)
  link_enable();
  mswait(100);
  link_reset();
  link_hello();
  for (int i = 0; i < 100000; i++) {
    char received[10];
    receive_msg(c, received, 10);
    if (safestrcmp(received, "chocolate") != 0) {
      // mismatch
    }
  }
  chan_free(c);
You do not have the required permissions to view the files attached to this post.