Author Topic: uTaskerBoot for CrossStudio  (Read 12810 times)

Offline Stan

  • Newbie
  • *
  • Posts: 18
    • View Profile
uTaskerBoot for CrossStudio
« on: April 04, 2008, 01:39:24 PM »
Hi Mark,

I was wondering if you intend to make a version of your bootloader for CrossStudio. I'm not familiar with .s79 files and so it would be quite difficult for me to make it by myself :] If you don't have such plans or enough time, please, can you guide me on how to move this project in CrossStudio? Thanks!

Offline mark

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3238
    • View Profile
    • uTasker
Re: uTaskerBoot for CrossStudio
« Reply #1 on: April 04, 2008, 02:24:03 PM »
Hi Stan

Which processor are you refering to?

Regards

Mark

Offline Stan

  • Newbie
  • *
  • Posts: 18
    • View Profile
Re: uTaskerBoot for CrossStudio
« Reply #2 on: April 07, 2008, 10:12:36 AM »
Hi Mark,

I haven't been able to write since my last post, so here I am again.

I'm talking about SAM7X. From what I understand I need uTasker Project for CrossStudio  with Bare-minimum configuration too. Or you can just help me to modify the .ld file. Thanks!

Regards

Stan
« Last Edit: April 07, 2008, 03:22:54 PM by Stan »

Offline mark

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3238
    • View Profile
    • uTasker
Re: uTaskerBoot for CrossStudio
« Reply #3 on: April 07, 2008, 05:20:43 PM »
Hi Stan

Yes, this is a good point - I will need to put in on my "to-do" list.

In the meantime you should be able to use the Crossworks project with the boot loader by doing the following:

Rather than linking the code to start at 0x100000, link it to start at 0x100700. This should be all that is needed to make it compatible with the pre-compiled boot loader - you will however need to use the standard settings for "magic number" and "key" when creating the upload file so that it matches the pre-compiled boot loader.

To compile the boot loader with Crossworks it will need its own project - this should not be a difficult task if you already know crosswork's project configuration. It just needs to be linked to start at 0x1000000. It must also occupy less that 0x700 code space (if not the start addresses have to be moved up to next FLASH sector). I think that the GCC initialisation is presently missing so this will have to be copied from SAM7X.c to SAM7X_boot.c before it actually works correctly...

Both projects have to be loaded to the HW so that they can work together. Some deguggers / FLASH programmers will allow this, otherwise the bat file BM-Convert.bat both merges them and creates an upload file (this works only with 0x700 link address - a new version [next SP] will allow more flexibility).

Good luck!!

Regards

Mark




Offline Stan

  • Newbie
  • *
  • Posts: 18
    • View Profile
Re: uTaskerBoot for CrossStudio
« Reply #4 on: April 10, 2008, 03:57:33 PM »
Hi Mark,

Thank you for your quick reply again :)
I've tried what you said but with no success.

First I tried to compile and merge the original files for Bootloader and uTasker  in IAR, they wen fine (with few errors in bootloader's source but I fixed them), then I merged them and upload with samba - eveything went ok, tried to change the software via the ftp - ok.

Then I compiled the CrossStudio Project with these changes in uTaskerSAM7X_FLASH.ld:

Before:
------------------------------------------------------------------------------------
MEMORY
{
  SRAM (wx) : ORIGIN  = 0x00200000, LENGTH = 0x00010000
  FLASH (rx) : ORIGIN = 0x00100000, LENGTH = 0x00040000
}

SECTIONS
{
  __SRAM_segment_start__  = 0x00200000;
  __SRAM_segment_end__    = 0x00210000;
  __FLASH_segment_start__ = 0x00100000;
  __FLASH_segment_end__   = 0x00140000;
------------------------------------------------------------------------------------

After:
------------------------------------------------------------------------------------
MEMORY
{
  SRAM (wx) : ORIGIN  = 0x00200000, LENGTH = 0x00010000
  FLASH (rx) : ORIGIN = 0x00100700, LENGTH = 0x00040000
}

SECTIONS
{
  __SRAM_segment_start__  = 0x00200000;
  __SRAM_segment_end__    = 0x00210000;
  __FLASH_segment_start__ = 0x00100700;
  __FLASH_segment_end__   = 0x00140000;
------------------------------------------------------------------------------------

I merged the files and uploaded it with samba but with no success. After this operation the LEDs for Link&Act, Speed and Full Duplex are blinking together in some kind of "alarm" mode.

Is there anything else which I am missing? I'm not sure if this change in the .ld file is enough, probably there are more differences between IAR and CrossStudio projects. And one more thing: I think the length for SRAM and FLASH in CrossStuio are too big, is this a problem, I saw that in IAR they are with shorter length?

Regards

Stan

Offline mark

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3238
    • View Profile
    • uTasker
Re: uTaskerBoot for CrossStudio
« Reply #5 on: April 10, 2008, 04:32:13 PM »
Hi Stan

If you leave the IAR boot loader installed I would expect the Rowley project, linked at 0x100700, to work together with it.
Can you debug?
As it is, the boot loader should find no new SW to update so execute the following:

    main_call = (void (*)(void))UTASKER_APP_START;
    main_call();                                                         // call code

where UTASKER_APP_START      0x100700 - the address of the reset vector of the application.

This means that I expect the application code to start.

After that point there is one more dependence on the boot code. This is still handling interrupt dispatching for the application, however I don't see how this could be incompatible between the two compilere(?)

If you can debug you should be able to see the application code starting - if you find that it runs until the first interrupt arrives it means that there is somehow an incompatibilty there. On the other hand you may find that there is a problem with loading somewhere and the code is not exactly there in memory as expected(?).

Regards

Mark


P.S. I looked into the compiler errors you reported in the IAR boot loader build in SAM7X V1.3 + SP3 and there is indeed a problem when compiled with SPI_SW_UPLOAD (SPI FLASH upload) but not when compiled for internal FLASH firmware upload.
The error I got was due to a missing define for _SIM_PORT_CHANGE in the SPI driver part. This is used by the simulator and so needs a dummy to remove it as follows when not _WINDOWS:
  #define _SIM_PORT_CHANGE

In my working version it was correct so I must have somehow missed this during the SP release. I assume you could quite easily repair it (either with the dummy define or by deleting the _SIM_PORT_CHANGE at three locations).

Are you therefore using SPI FLASH for the firmware upload?
« Last Edit: April 10, 2008, 05:34:33 PM by mark »