Programming MC1321x from Linux

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

Programming MC1321x from Linux

2,275件の閲覧回数
lineage
Contributor III
I'd like to be able to program the flash on a MC1321x Zigbee board from a linux host. Ideally using the embedded boot loader or using the P&E USB Multilink. I have .s19 files, I just want to load them without having to go find an MS-Windows machine every time.

Is there a linux version of the embedded bootloader app?

Is there a doc anywhere that has the 'on-the-wire' protocol for the embedded bootloader so I can write an app?

Anyone got any ideas? The CPU is an MC9S08.

Thanks
ラベル(1)
0 件の賞賛
返信
3 返答(返信)

650件の閲覧回数
lineage
Contributor III

I'll answer my own question having found AN2295 in case its of use to anyone else.....

AN2295 is a simple resident bootloader. Bit like the embedded one, but documented :smileywink:
Grab the AN and the AN2295SW, unpack it. There is a master(host) and target section.

First sort out the linux loader (master) end:
The loader almost built without a hitch. The only minor issue was undefined strnicmp function on my system. Easilly 'kludged'

cd an2295sw/master/
edit prog.c

add:    #define strnicmp strncasecmp

Then it will make

Then sort out the slave end:
      
load up codewarrior
      
open an2295sw/HC08 bootloader/HC08 bootloader.mcp
find the  hc08sprg->S08->hc08sprg-08gbgt.mcp branch

For the main controller unit, on the targets tab, select the
"S08GB/GT60(A) SCI1, MC1321x" target which creates

    an2295sw/src/S08GBGT/bin/hc08sprg-s08gbgt60-sci1.abs.s19

This will work on the DSUB-9 port

The "S08GB/GT60(A) SCI2" target makes

    an2295sw/src/S08GBGT/bin/hc08sprg-s08gbgt60-sci2.abs.s19

Which works using the USB port on either the NCB or SRB

You have to do a one-time load with a BDM. I used a P&E USB Multilink and Test Tool (which you can get from www.freescale.com/zigbee)

Once you have got the loader in there all you do is;

    Run the hc08sprg loader on the linux system and just dab the reset button on the module.

As the module resets it mumbles to the loader and that stops the rest of the boot.

Typical output:

localhost:cas:master>./hc08sprg /dev/ttyUSB1 9600 "Wireless UART SRB.S19"
---------------------------------------------------------------------------
hc08sprg - Developer's Serial Bootloader for HC(S)08 - $Version: 9.0.37.0$
---------------------------------------------------------------------------
FC protocol versions supported:
        0x01 (HC08)
        0x03 (large HC08)
        0x02 (S08)
        0x06 (long S08)
        0x0A (large S08)
---------------------------------------------------------------------------

Parsed S-record lines: 133  Bytes total: 4163
Source address range: 0x182C-0xFFFF

Waiting for HC(S)08 reset ACK...received 0x2f (ignoring).
received 0x0f (ignoring).
received 0xe2 (ignoring).
received 0xe2 (ignoring).
--- the above is just junk output from the code running on the SRB
--- I hit reset at this point
received 0xfc (good).
Calibration break pulse sent. Count: 1

Bootloader protocol version: 0x02 (S08, read command supported)
Bootloader version string: GB/GT60(A)
System device ID: 0x002 [MC9S08(GB/GT)(32-60),MC1321x] rev. 8
Number of memory blocks: 2
Memory block #1: 0x1080-0x17FF
Memory block #2: 0x182C-0xFDBF
Erase block size: 512 bytes
Write block size: 128 bytes
Original vector table: 0xFFC0-0xFFFF
New vector table:      0xFDC0-0xFDFF

Are you sure to program part? [y/N]: y
Memory programmed:           100%
Memory verified:             OK

Hit reset again and your code is running!
So far, seems to work OK.

0 件の賞賛
返信

650件の閲覧回数
Mads
Contributor V
0 件の賞賛
返信

650件の閲覧回数
lineage
Contributor III
Mads,

Thanks - intersting site. The CW/SDCC comparison is useful too.
I'm guessing the programming dongle there wont work on the MC1321x BDM port though..

Cheers



0 件の賞賛
返信