Running FreeRTOS after a USB bootloader

We have successfully built the USB bootloader from the NXP Keil example (AN10759 Secondary bootloader for the LPC23xx) using the Keil demo ARM MDK.  Everything works .. the bootloader works, the blinky example works fine, etc. We WANT to use the GNU toolchain for our actual solution to a user app (i.e. one that is loaded by the secondary bootloader). We have successfully built and ran the FreeRTOS demo as a "regular" app with the GNU Toolchain and runs fine on our MCB2300 board. Our next step is to try to modify the linker (.ld file and .s files?) to now run the same demo as a "user app" that is loaded using the USB loader.  It appears that this would be as simple as adding the offset to the new start address?  The example is using 0x2000. Keil does this through a little property wizard (it looks like), but we have tried several things in the .ld file and .s file and all we get is a crash. What do we need to do to build FreeRTOS correctly to be loadable by the USB Bootloader?

Running FreeRTOS after a USB bootloader

Can’t seem to edit my previous post … so a correction. We successfully built and ran the FreeRTOS demo using Crossworks (** NOT** GNU toolchain). We have successfully ran a FreeRTOS project using GNU toolchain, but not the demo specifically … in case that matters …

Running FreeRTOS after a USB bootloader

We use a bootloader on the SAM7 which I wrote, we also use crossworks (which is a excellent frontend to the GNU compiler). If your bootloader is 8k for example, then setup your bootloader project to set the flash starting address as 0 and the size as 8k.  In your application, set the flash starting address as 8k and then subtract 8k from the flash end address. In your bootloader jump to 8k once you know everything is ok. btw, I do the jump something like:     void (*application)(void) = (8*1024);
   
    application(); Adrian

Running FreeRTOS after a USB bootloader

Thanks Adrian! We already have the USB loader and such working in Keil, so we understand the concept.  What we don’t know, is HOW you do it in the tool?  Exactly how do you do it in Crossworks, for example?  Which property do you set and where in the project?  Do you do it in the Memory map file?  Or some other property? Thanks!

Running FreeRTOS after a USB bootloader

OK, a little more info … The USB bootloader is working fine … and we can run a user application built in Kiel with a 0x2000 offset (their blinky example).  All works great … SO … that’s all good … NOW want to build user applications (blinky) in Crossworks.  Our new user app (Crossworks sample for the MCB2300 board called LED) will just simply be something we can download to the board using the bootloader. To do this we go to LED.c and in the Memory Map editor: We change the line: <MemorySegment start="0x00000000" size="0x80000" access="ReadOnly" name="FLASH"/> to <MemorySegment start="0x00002000" size="0x7e000" access="ReadOnly" name="FLASH"/> Rebuild everything, then drag and drop the  the .bin file on the mounted "drive" (our board). Everything downloads fine, we hit RESET and it seems to start to run and crashes immediately. What are we missing in Crossworks settings/properties?  THANKS!

Running FreeRTOS after a USB bootloader

Once we know that … we can go back to the FreeRTOS demo and make it run (hopefully)

Running FreeRTOS after a USB bootloader

Sorry … quick update!  Found the problem and now we have the Crossworks LED stuff working … !  So we’ve proven we can make a "User App" that our bootloader can download and start. Now to BACK TO THE CENTRAL ISSUE FINALLY! <*grin*> We can build the FreeRTOS Demo in Crossworks 2.0 and run it "out of the box" just fine.  We change the memory map (like we did for the blinky) and we can’t get it to run. It looks like it does indeed start, but none of the tasks get started … We are using a Keil MCB2300 board with an LPC2368 processor on it, just for background. We change the Memory start line (as stated above) in the FreeRTOS demo and then load it with our USB Bootloader and it seems to start but doesn’t start any tasks. To summarize: 1.  Demo works fine "out of the box"
2.  Change the memory map line, download it with the USB loader … doesn’t run What should we be looking for?  Did we miss something with the interrupts or something? THANKS!

Running FreeRTOS after a USB bootloader

Have you remapped the interrupt vectors? Presumably your boot load is at address zero, so when the FreeRTOS app starts to run it will try to use the vector table defined by the bootloader.

Running FreeRTOS after a USB bootloader

We suspected as much, but what in particular needs to be done to "remap the vectors"?  Does it just involve adding 0x2000 to the VIC entries? Thanks!