Migrate from a Teensy to bare metal?

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

Migrate from a Teensy to bare metal?

3,276 Views
timothymoulton
Contributor I

We are migrating a design from the Teensy platform to a bare metal board with a MK20DX256VLL7 standalone processor and I need to figure out the fastest way to:

-Get an image of our application (developed using the Teensy toolchain) compiled and running on our bare metal board through JTAG

-Alternatively port the application to KDS. However, we rely on a bunch of libraries on the Teensy side, use a different IDE and we are scared of the time involved here.

We incorrectly surmised that we could load a hex or elf file compiled for the teensy onto our board, but the application will not start. Thus we are in a tricky spot.

Thank you 

Tim

0 Kudos
6 Replies

2,028 Views
panayiotismicha
Contributor I

Hello Tim,

Did you ever find a solution to your problem?

Would you mind sharing?

Panos

0 Kudos

2,028 Views
timothymoulton
Contributor I

Mark,

Thank you so much for your help. I really hope this runs, as what you typed above is exactly what I thought. I have two concerns though:

1. In the Teensy, the MKL02 chip is not on the USB lines, so I believe it houses a static bootloader that loads onto the MK20 chip and then, using that code, the MK20 pulls the elf file through the USB. So, my concern is that my loaded code with JTAG will not run without the bootloader that comes from the MKL02 chip. I am a beginner here, but I fear that on power up the MK20 program counter goes to where the bootloader code would normally live.

2. Do you think there is any difference to teh binary with the MK20DX256VLH7 vs.  MK20DX256VLL7?

Thanks again.

Tim

0 Kudos

2,028 Views
mjbcswitzerland
Specialist V

Tim

On the teensy the KL02 will load a small program to the RAM of the K20 (using JTAG or SWD) and this program will receive code and program it to the Flash.
When you restart the board (without the RESET held) the KL02 does 'nothing' so the code is booting directly in the K20. If you remove the KL02 from a Teensy that has code loaded the code will still work.

LH7 and LL7 have different user manuals which generally means that there is some (small or larger) difference between them. In some cases there is a module that is missing or has less channels and so if you try to use that it will hard-fault.

The simplest method to find it is to connect the debugger and if it hard faults you can see the bad address and then fix the code accordingly. Just download IAR Kickstart version and use that in disassembly mode - KDS is not very good as this because it is too clumsy at just playing with disassembled code that it hasn't generated itself.

If you have a commercial need it can probably be fixed with a few minutes of remote desktop support - see professional services at http://www.utasker.com/services.html

Regards

Mark

0 Kudos

2,028 Views
timothymoulton
Contributor I

The only differences we know of are:

-The absence of the MKL02Z32 Micro controller on the programming lines

-Using the package/chip MK20DX256VLL7 instead of MK20DX256VLH7

-The inclusion of a crystal for the RTC

-Reset line is pulled high

So, you are saying we should be able to load the elf file from the Teensy compilation and it will start? Oh gosh that would be nice. Thanks for the response.

0 Kudos

2,028 Views
mjbcswitzerland
Specialist V

Tim

When you load your code to the teensy via its HalfKay chip it is this chip (KL02) that is effectively acting as a JTAG programmer for you. So whether via KL02 or JTAG probe the result should be identical.

There is a small possibility that the KL02 is changing the flash config values that are programmed (you will need to ask PJRC whether he knows of anything here).

In any case now that you have a debugger connected you should be able to quite easily debug what is going on and why it isn't starting as expected.

Regards

Mark

0 Kudos

2,028 Views
mjbcswitzerland
Specialist V

Tim

A teensy hex file will run on a compatible hardware when loaded with Jtag or EzPort.

If it doesn't, you have a HW problem (or the SW doesn't accurately match your HW - for example, check that its crystal loading is the same because if not you could need a different clock setting) and KDS will not help in any way.

Regards

Mark

http://www.utasker.com/kinetis/TEENSY_3.1.html

0 Kudos