Author Topic: uTasker Bootloader  (Read 21485 times)

Offline phomann

  • Newbie
  • *
  • Posts: 47
    • View Profile
    • Homann Designs
uTasker Bootloader
« on: October 02, 2008, 07:45:48 AM »
Mi Mark,

I tried to build the Bootloader project using uVision and get the following errors:
Code: [Select]
Build target 'uTaskerBoot'
linking...
.\Objects\uTaskerBoot.axf: Error: L6320W: Ignoring --entry command. Cannot find argument 'Reset_Handler'.
.\Objects\uTaskerBoot.axf: Warning: L6320W: Ignoring --first command. Cannot find argument '__Vectors'.
Target not created

I presume that the addresses of these two need to be set up some where?

Cheers,

Peter.

Offline mark

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3234
    • View Profile
    • uTasker
Re: uTasker Bootloader
« Reply #1 on: October 02, 2008, 11:32:18 AM »
Hi Peter

I don't know where these are coming from, perhaps your uVision has added the standard Keil LM3S startup to the project (?).

The start up code can be found in LM3SXXXX_boot.c:

// The initial stack pointer and PC value - this is linked at address 0x00000000
//
#if defined COMPILE_IAR
__root const RESET_VECTOR reset_vect @ "RESETVECT"                       // __root forces the function to be linked in IAR project
#elif defined _GNU
const RESET_VECTOR __attribute__((section(".vectors"))) reset_vect
#elif defined _COMPILE_KEIL
__attribute__((section("RESET"))) const RESET_VECTOR reset_vect
#else
const RESET_VECTOR reset_vect
#endif
= {
    (void *)(START_OF_SRAM + SIZE_OF_RAM),                               // stack pointer to top of RAM
    START_CODE
};


Make sure that the pre-processor define _COMPILE_KEIL has not been removed from the project.
The only assembler file in the project should be LM3SXXXX_startup_keil.s since the start up code is purely in C (the only reason for the small assembler file is due to the fact the the Keil compiler only supports inline assembler in ARM mode - the Cortex 3M has only Thumb2 mode so the inline assembler is essentially not possible (at least I couldn't find a way around it).

Regards

Mark

Offline phomann

  • Newbie
  • *
  • Posts: 47
    • View Profile
    • Homann Designs
Re: uTasker Bootloader
« Reply #2 on: October 03, 2008, 12:31:01 AM »
Hi Mark,

Thanks for the help. No joy though. I've attached the setting tab for the compiler and linker. I can't see anything obvious.

Cheers,

Peter.

Offline mark

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3234
    • View Profile
    • uTasker
Re: uTasker Bootloader
« Reply #3 on: October 03, 2008, 01:16:55 AM »
Peter

There is a difference in the linker settings.
In my reference the command line parameters are:

*.o --device DLM --strict --scatter ".\Objects\uTaskerBoot.sct"
--autoat --summary_stderr --info summarysizes --map --xref --callgraph --symbols


The "Use memory layout from target dialog" check box is checked but not grayed out - this may be coupled with some other setting somewhere. Possibly just removing the references to the missing symbols from your linker command line will resolve it.

Regards

Mark

Offline phomann

  • Newbie
  • *
  • Posts: 47
    • View Profile
    • Homann Designs
Re: uTasker Bootloader
« Reply #4 on: October 03, 2008, 04:41:43 AM »
Hi Mark,

If you look in the standard Keil directory, C:\Keil\ARM\Startup\Luminary They have an assembly  startup file called Startup.s

its contents are below and in it are the missing vectors. None of the files in the C:\uTaskerV1.3_beta-LM3S\Hardware\LM3SXXXX directory or anywhere under the C:\uTaskerV1.3_beta-LM3S can I find a file that has the vector table.

Code: [Select]
; <<< Use Configuration Wizard in Context Menu >>>
;******************************************************************************
;
; Startup.s - Startup code for Stellaris.
;
; Copyright (c) 2006-2008 Luminary Micro, Inc.  All rights reserved.
;
; Software License Agreement
;
; Luminary Micro, Inc. (LMI) is supplying this software for use solely and
; exclusively on LMI's microcontroller products.
;
; The software is owned by LMI and/or its suppliers, and is protected under
; applicable copyright laws.  All rights are reserved.  You may not combine
; this software with "viral" open-source software in order to form a larger
; program.  Any use in violation of the foregoing restrictions may subject
; the user to criminal sanctions under applicable laws, as well as to civil
; liability for the breach of the terms and conditions of this license.
;
; THIS SOFTWARE IS PROVIDED "AS IS".  NO WARRANTIES, WHETHER EXPRESS, IMPLIED
; OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
; MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE.
; LMI SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR
; CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
;
; This is part of revision 2523 of the Stellaris Peripheral Driver Library.
;
;******************************************************************************

;******************************************************************************
;
; <o> Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
;
;******************************************************************************
Stack   EQU     0x00000100

;******************************************************************************
;
; <o> Heap Size (in Bytes) <0x0-0xFFFFFFFF:8>
;
;******************************************************************************
Heap    EQU     0x00000000

;******************************************************************************
;
; Allocate space for the stack.
;
;******************************************************************************
        AREA    STACK, NOINIT, READWRITE, ALIGN=3
StackMem
        SPACE   Stack
__initial_sp

;******************************************************************************
;
; Allocate space for the heap.
;
;******************************************************************************
        AREA    HEAP, NOINIT, READWRITE, ALIGN=3
__heap_base
HeapMem
        SPACE   Heap
__heap_limit

;******************************************************************************
;
; Indicate that the code in this file preserves 8-byte alignment of the stack.
;
;******************************************************************************
        PRESERVE8

;******************************************************************************
;
; Place code into the reset code section.
;
;******************************************************************************
        AREA    RESET, CODE, READONLY
        THUMB

;******************************************************************************
;
; The vector table.
;
;******************************************************************************
        EXPORT  __Vectors
__Vectors
        DCD     StackMem + Stack            ; Top of Stack
        DCD     Reset_Handler               ; Reset Handler
        DCD     NmiSR                       ; NMI Handler
        DCD     FaultISR                    ; Hard Fault Handler
        DCD     IntDefaultHandler           ; MPU Fault Handler
        DCD     IntDefaultHandler           ; Bus Fault Handler
        DCD     IntDefaultHandler           ; Usage Fault Handler
        DCD     0                           ; Reserved
        DCD     0                           ; Reserved
        DCD     0                           ; Reserved
        DCD     0                           ; Reserved
        DCD     IntDefaultHandler           ; SVCall Handler
        DCD     IntDefaultHandler           ; Debug Monitor Handler
        DCD     0                           ; Reserved
        DCD     IntDefaultHandler           ; PendSV Handler
        DCD     IntDefaultHandler           ; SysTick Handler
        DCD     IntDefaultHandler           ; GPIO Port A
        DCD     IntDefaultHandler           ; GPIO Port B
        DCD     IntDefaultHandler           ; GPIO Port C
        DCD     IntDefaultHandler           ; GPIO Port D
        DCD     IntDefaultHandler           ; GPIO Port E
        DCD     IntDefaultHandler           ; UART0
        DCD     IntDefaultHandler           ; UART1
        DCD     IntDefaultHandler           ; SSI
        DCD     IntDefaultHandler           ; I2C
        DCD     IntDefaultHandler           ; PWM Fault
        DCD     IntDefaultHandler           ; PWM Generator 0
        DCD     IntDefaultHandler           ; PWM Generator 1
        DCD     IntDefaultHandler           ; PWM Generator 2
        DCD     IntDefaultHandler           ; Quadrature Encoder
        DCD     IntDefaultHandler           ; ADC Sequence 0
        DCD     IntDefaultHandler           ; ADC Sequence 1
        DCD     IntDefaultHandler           ; ADC Sequence 2
        DCD     IntDefaultHandler           ; ADC Sequence 3
        DCD     IntDefaultHandler           ; Watchdog
        DCD     IntDefaultHandler           ; Timer 0A
        DCD     IntDefaultHandler           ; Timer 0B
        DCD     IntDefaultHandler           ; Timer 1A
        DCD     IntDefaultHandler           ; Timer 1B
        DCD     IntDefaultHandler           ; Timer 2A
        DCD     IntDefaultHandler           ; Timer 2B
        DCD     IntDefaultHandler           ; Comp 0
        DCD     IntDefaultHandler           ; Comp 1
        DCD     IntDefaultHandler           ; Comp 2
        DCD     IntDefaultHandler           ; System Control
        DCD     IntDefaultHandler           ; Flash Control
        DCD     IntDefaultHandler           ; GPIO Port F
        DCD     IntDefaultHandler           ; GPIO Port G
        DCD     IntDefaultHandler           ; GPIO Port H
        DCD     IntDefaultHandler           ; UART2 Rx and Tx
        DCD     IntDefaultHandler           ; SSI1 Rx and Tx
        DCD     IntDefaultHandler           ; Timer 3 subtimer A
        DCD     IntDefaultHandler           ; Timer 3 subtimer B
        DCD     IntDefaultHandler           ; I2C1 Master and Slave
        DCD     IntDefaultHandler           ; Quadrature Encoder 1
        DCD     IntDefaultHandler           ; CAN0
        DCD     IntDefaultHandler           ; CAN1
        DCD     IntDefaultHandler           ; CAN2
        DCD     IntDefaultHandler           ; Ethernet
        DCD     IntDefaultHandler           ; Hibernate
        DCD     IntDefaultHandler           ; USB0
        DCD     IntDefaultHandler           ; PWM Generator 3
        DCD     IntDefaultHandler           ; uDMA Software Transfer
        DCD     IntDefaultHandler           ; uDMA Error

;******************************************************************************
;
; This is the code that gets called when the processor first starts execution
; following a reset event.
;
;******************************************************************************
        EXPORT  Reset_Handler
Reset_Handler
        ;
        ; Call the C library enty point that handles startup.  This will copy
        ; the .data section initializers from flash to SRAM and zero fill the
        ; .bss section.
        ;
        IMPORT  __main
        B       __main

;******************************************************************************
;
; This is the code that gets called when the processor receives a NMI.  This
; simply enters an infinite loop, preserving the system state for examination
; by a debugger.
;
;******************************************************************************
NmiSR
        B       NmiSR

;******************************************************************************
;
; This is the code that gets called when the processor receives a fault
; interrupt.  This simply enters an infinite loop, preserving the system state
; for examination by a debugger.
;
;******************************************************************************
FaultISR
        B       FaultISR

;******************************************************************************
;
; This is the code that gets called when the processor receives an unexpected
; interrupt.  This simply enters an infinite loop, preserving the system state
; for examination by a debugger.
;
;******************************************************************************
IntDefaultHandler
        B       IntDefaultHandler

;******************************************************************************
;
; Make sure the end of this section is aligned.
;
;******************************************************************************
        ALIGN

;******************************************************************************
;
; Some code in the normal code section for initializing the heap and stack.
;
;******************************************************************************
        AREA    |.text|, CODE, READONLY

;******************************************************************************
;
; The function expected of the C library startup code for defining the stack
; and heap memory locations.  For the C library version of the startup code,
; provide this function so that the C library initialization code can find out
; the location of the stack and heap.
;
;******************************************************************************
    IF :DEF: __MICROLIB
        EXPORT  __initial_sp
        EXPORT  __heap_base
        EXPORT __heap_limit
    ELSE
        IMPORT  __use_two_region_memory
        EXPORT  __user_initial_stackheap
__user_initial_stackheap
        LDR     R0, =HeapMem
        LDR     R1, =(StackMem + Stack)
        LDR     R2, =(HeapMem + Heap)
        LDR     R3, =StackMem
        BX      LR
    ENDIF

;******************************************************************************
;
; Make sure the end of this section is aligned.
;
;******************************************************************************
        ALIGN

;******************************************************************************
;
; Tell the assembler that we're done.
;
;******************************************************************************
        END


I tried adding the Keil startup file (C:\Keil\ARM\Startup\Luminary\Startup.s) to the project and got the error below. Is there a file missing from the LM3 bootloader project?

Code: [Select]
Build target 'uTaskerBoot'
assembling Startup.s...
linking...
.\Objects\uTaskerBoot.axf: Error: L6200E: Symbol __user_initial_stackheap multiply defined (by startup.o and lm3sxxxx_startup_keil.o).
Target not created



Cheers,

Peter.

Offline phomann

  • Newbie
  • *
  • Posts: 47
    • View Profile
    • Homann Designs
Re: uTasker Bootloader
« Reply #5 on: October 05, 2008, 10:02:40 AM »
Hi Mark,

Did you manage to see if there is a missing file with the bootloader?

Cheers,

Peter

Offline mark

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3234
    • View Profile
    • uTasker
Re: uTasker Bootloader
« Reply #6 on: October 05, 2008, 09:32:49 PM »
Hi Peter

The project doesn't use the starup.s delivered with the Keil project due to the fact that the initialisation is performed in C rather than in assembler. See LM3SXXXX_boot.c. The setup delivered with Keil is however configured to work with this and so forces the two variables which are now missing (I don't understand why the configuration has somehow reverted back to this - the Keil project in the SP doesn't include these references).

I still think that you need to find out what is forcing the --entry Reset_Handler and --first __Vectors because these are being set in the configuration but not in the project that I set up (I used V3.62c - perhaps different versions are not fully compatible and default to some defaults..(?)). If you can identify where  they are coming from and remove them it should then link correctly.

Another possiility which could have solved the difficulty would have been to simply add 2 variables with these names, but I believe the --first is forcing __Vectors to the start of FLASH (0x0000000) whereas what we need is the struct reset_vect there (see __attribute__ ((section("RESET"))) const RESET_VECTOR reset_vect in LM3SXXXX_boot.c. So, although this may enable it to link, it may boot from the dummy variable rather than the RESET_VECTOR struct, which would then not run.

It may be an idea to send me your project (just the boot loader directory contents with your version of boot_loader.Uv2) so that I can open it with my Keil version to see whether it also adds these. Maybe I can also identify why.

Regards

Mark

Offline phomann

  • Newbie
  • *
  • Posts: 47
    • View Profile
    • Homann Designs
Re: uTasker Bootloader
« Reply #7 on: October 06, 2008, 12:36:19 AM »
Hi mark,

I've sent the project to you as I can't see how to remove the 2 vaeiablel.

Cheers,

Peter.

Offline mark

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3234
    • View Profile
    • uTasker
Re: uTasker Bootloader
« Reply #8 on: October 07, 2008, 12:06:45 PM »
Hi Peter

As it turns out, this is probably a restriction of the Keil evaluation version. It seems to force the use of a library, which also adds 16k or zeros in order to increase the project size. See the following for an overview of my experience:
http://www.luminarymicro.com/component/option,com_joomlaboard/Itemid,/func,view/catid,5/id,2577/#2577 (look for post from mjbcswitzerland).

This means that project can probably not be tested with the evaluation versionof Keil and the evaluation version is also not of much use as a solution for small projects since it blows itself up in size. It would also be necessary to create a new uTasker project version which is compatible with the evaluation version and its behaviour...

Therefore I recommend avoiding Keil for evaluation or small project work. A 32k limited IAR version is much more suitable for small projects since it is fully functional with no such restrictions. A full feature evaluation of the Rowley Crossworks is a very comfortable and well supported solution, with other GCC based ones available too.

Regards

Mark