>> /* LPC SRAM starts at 0x40000000, and there is 32Kb
= 8000h */
>> STACK_START: .word 0x40008000
On Wed, 17 Oct 2007, David Hawkins wrote:
> If your processor has less SRAM, then you'd
better make sure your stack
> pointer is located appropriately.
I've been using the linker script to "ensure" (to the extent that it
appears impossible, unfortunately, to use relative LENGTH directives
in MEMORY sections) this:
----
/* specify the LPC2148 memory areas */
MEMORY
{
flash(RX) : ORIGIN = 0, LENGTH = 500K
ram_isp_low(!A) : ORIGIN = 0x40000000, LENGTH = 0x200
ram(!X) : ORIGIN = 0x40000200, LENGTH =
0x7DE0
ram_isp_high(!A) : ORIGIN = 0x40007FE0, LENGTH = 32
ram_usb_dma(!A) : ORIGIN = 0x7FD00000, LENGTH = 8K
}
_bss_end = . ;
_end = .;
.stack :
{
_stack_end = .;
} > ram_isp_high
}
----
-Kenny, who'd like to hear if there's any pitfalls this way
--
Kenneth R. Crudup Sr. SW Engineer, Scott County Consulting, Los Angeles
O: 3630 S. Sepulveda Blvd. #138, L.A., CA 90034-6809 (888) 454-8181
Micrium UCOS-II
Started by ●September 13, 2007
Reply by ●October 17, 20072007-10-17
Reply by ●October 17, 20072007-10-17
On Wed, 17 Oct 2007, David Hawkins wrote:
> I'd been meaning to look at the WinAVR linker files to
> see how they do it ... I seem to recall being able
> to set a processor type and having things 'taken care of'.
Probably pre-defined tables.
-Kenny
--
Kenneth R. Crudup Sr. SW Engineer, Scott County Consulting, Los Angeles
O: 3630 S. Sepulveda Blvd. #138, L.A., CA 90034-6809 (888) 454-8181
> I'd been meaning to look at the WinAVR linker files to
> see how they do it ... I seem to recall being able
> to set a processor type and having things 'taken care of'.
Probably pre-defined tables.
-Kenny
--
Kenneth R. Crudup Sr. SW Engineer, Scott County Consulting, Los Angeles
O: 3630 S. Sepulveda Blvd. #138, L.A., CA 90034-6809 (888) 454-8181
Reply by ●October 17, 20072007-10-17
Hi Kenny,
> I've been using the linker script to "ensure" (to the extent that it
> appears impossible, unfortunately, to use relative LENGTH directives
> in MEMORY sections) this:
Yeah, I'd wanted to find a way to use the linker script,
or some form of parameter that I could place in the Makefile
to generate the RAM size, and then stack location.
I'd been meaning to look at the WinAVR linker files to
see how they do it ... I seem to recall being able
to set a processor type and having things 'taken care of'.
But alas, LPCs and AVRs are playthings for me, and I've
had no time to play with them.
Maybe I'll get to play with your technique, or maybe we'll
get to see some of the other options people use to make their
linker/startup code independent of the processor memory size.
Cheers,
Dave
> I've been using the linker script to "ensure" (to the extent that it
> appears impossible, unfortunately, to use relative LENGTH directives
> in MEMORY sections) this:
Yeah, I'd wanted to find a way to use the linker script,
or some form of parameter that I could place in the Makefile
to generate the RAM size, and then stack location.
I'd been meaning to look at the WinAVR linker files to
see how they do it ... I seem to recall being able
to set a processor type and having things 'taken care of'.
But alas, LPCs and AVRs are playthings for me, and I've
had no time to play with them.
Maybe I'll get to play with your technique, or maybe we'll
get to see some of the other options people use to make their
linker/startup code independent of the processor memory size.
Cheers,
Dave
Reply by ●October 18, 20072007-10-18
Hi Dave and rest of group
I have now got a startup code that works with initialisation code
Thanks for all the help
Regards
Jean-Jacques
I have now got a startup code that works with initialisation code
Thanks for all the help
Regards
Jean-Jacques
Reply by ●October 18, 20072007-10-18
Hi Jean-Jacques,
> I have now got a startup code that works with initialisation code
Could you please post what you needed to fix, thanks.
Dave
> I have now got a startup code that works with initialisation code
Could you please post what you needed to fix, thanks.
Dave
Reply by ●October 18, 20072007-10-18
Hi Dave
This is the startup code I modified to use now
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
/* ucos_ex1_start.s */
.global main
.global _start
/* Symbols defined by the linker script */
.global _etext
.global _data
.global _edata
.global _bss
.global _ebss
/* External functions */
.global OS_CPU_IRQ_ISR
.global OS_CPU_FIQ_ISR
.text
.arm
/* ----------------------------
* Exception vectors
* ----------------------------
*/
_start:
vectors:
ldr PC, Reset_Addr
ldr PC, Undef_Addr
ldr PC, SWI_Addr
ldr PC, PAbt_Addr
ldr PC, DAbt_Addr
nop /* reserved for the bootloader checksum */
ldr pc, irq_addr
ldr pc, fiq_addr
Reset_Addr: .word Reset_Handler /* defined in this
module below */
Undef_Addr: .word UNDEF_Routine /* defined in bsp.c
*/
SWI_Addr: .word SWI_Routine /* defined in
bsp.c */
PAbt_Addr: .word UNDEF_Routine /* defined in bsp.c
*/
DAbt_Addr: .word UNDEF_Routine /* defined in bsp.c
*/
irq_addr: .word OS_CPU_IRQ_ISR
fiq_addr: .word OS_CPU_FIQ_ISR
/* ----------------------------
* LPC21xx stacks setup
* ----------------------------
*/
Reset_Handler:
ldr r0, STACK_START
/* FIQ mode stack */
msr CPSR_c, #FIQ_MODE|IRQ_DISABLE|FIQ_DISABLE
mov sp, r0
sub r0, r0, #FIQ_STACK_SIZE
/* IRQ mode stack */
msr CPSR_c, #IRQ_MODE|IRQ_DISABLE|FIQ_DISABLE
mov sp, r0
sub r0, r0, #IRQ_STACK_SIZE
/* Supervisor mode stack */
msr CPSR_c, #SVC_MODE|IRQ_DISABLE|FIQ_DISABLE
mov sp, r0
sub r0, r0, #SVC_STACK_SIZE
/* Undefined mode stack */
msr CPSR_c, #UND_MODE|IRQ_DISABLE|FIQ_DISABLE
mov sp, r0
sub r0, r0, #UND_STACK_SIZE
/* Abort mode stack */
msr CPSR_c, #ABT_MODE|IRQ_DISABLE|FIQ_DISABLE
mov sp, r0
sub r0, r0, #ABT_STACK_SIZE
/* System mode stack */
/* msr CPSR_c, #SYS_MODE|IRQ_DISABLE|FIQ_DISABLE */
msr CPSR_c, #SYS_MODE
mov sp, r0
/* Leave the processor in system mode */
/* ----------------------------
* C runtime setup
* ----------------------------
*/
/* copy .data section (Copy from ROM
to RAM) */
ldr R1, =_etext
ldr R2, =_data
ldr R3, =_edata
1:
cmp R2, R3
ldrlo R0, [R1], #4
strlo R0, [R2], #4
blo 1b
/* Clear .bss section (Zero init) */
mov R0, #0
ldr R1, =_bss
ldr R2, =_ebss
2:
cmp R1, R2
strlo R0, [R1], #4
blo 2b
/* Jump to main */
bl main
/* Catch return from main */
loop: b loop
/* ----------------------------
* 32-bit constants (and storage)
* ----------------------------
*
* These 32-bit constants are used in ldr statements.
*/
/* LPC SRAM starts at 0x40000000, and there is 16Kb = 4000h */
STACK_START: .word 0x40004000
/* Linker symbols */
data_source: .word _etext
data_start: .word _data
data_end: .word _edata
bss_start: .word _bss
bss_end: .word _ebss
/* ----------------------------
* 8-bit constants
* ----------------------------
*
* These 8-bit constants are used as immediate values and offsets.
*/
/* PLL configuration */
.equ PLLCON_OFFSET, 0x0
.equ PLLCFG_OFFSET, 0x4
.equ PLLSTAT_OFFSET, 0x8
.equ PLLFEED_OFFSET, 0xC
.equ PLLCON_PLLE, (1 << 0)
.equ PLLCON_PLLC, (1 << 1)
.equ PLLSTAT_PLOCK, (1 << 10)
.equ PLLFEED1, 0xAA
.equ PLLFEED2, 0x55
.equ PLLCFG_VALUE, 0x23
/* MAM configuration */
.equ MAMCR_OFFSET, 0x0
.equ MAMTIM_OFFSET, 0x4
.equ MAMCR_VALUE, 0x2 /* fully enabled */
.equ MAMTIM_VALUE, 0x4 /* fetch cycles */
/* Stack configuration */
/* Processor modes (see pA2-11 ARM-ARM) */
.equ FIQ_MODE, 0x11
.equ IRQ_MODE, 0x12
.equ SVC_MODE, 0x13 /* reset mode */
.equ ABT_MODE, 0x17
.equ UND_MODE, 0x1B
.equ SYS_MODE, 0x1F
/* Stack sizes */
.equ FIQ_STACK_SIZE, 0x00000080 /* 32x32-bit words */
.equ IRQ_STACK_SIZE, 0x00000080
.equ SVC_STACK_SIZE, 0x00000080
.equ ABT_STACK_SIZE, 0x00000010 /* 4x32-bit words */
.equ UND_STACK_SIZE, 0x00000010
.equ SYS_STACK_SIZE, 0x00000400 /* 256x32-bit words */
/* CPSR interrupt disable bits */
.equ IRQ_DISABLE, (1 << 7)
.equ FIQ_DISABLE, (1 << 6)
.end
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
I do the PLL and MAM init in the init c code
some of the code in the start.s need to me removed
Now I can get on with the project feeding pigs.
Thanks for your help
Regards
Jean-Jacques
--- In l..., David Hawkins wrote:
>
> Hi Jean-Jacques,
>
> > I have now got a startup code that works with initialisation code
>
> Could you please post what you needed to fix, thanks.
>
> Dave
>
This is the startup code I modified to use now
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
/* ucos_ex1_start.s */
.global main
.global _start
/* Symbols defined by the linker script */
.global _etext
.global _data
.global _edata
.global _bss
.global _ebss
/* External functions */
.global OS_CPU_IRQ_ISR
.global OS_CPU_FIQ_ISR
.text
.arm
/* ----------------------------
* Exception vectors
* ----------------------------
*/
_start:
vectors:
ldr PC, Reset_Addr
ldr PC, Undef_Addr
ldr PC, SWI_Addr
ldr PC, PAbt_Addr
ldr PC, DAbt_Addr
nop /* reserved for the bootloader checksum */
ldr pc, irq_addr
ldr pc, fiq_addr
Reset_Addr: .word Reset_Handler /* defined in this
module below */
Undef_Addr: .word UNDEF_Routine /* defined in bsp.c
*/
SWI_Addr: .word SWI_Routine /* defined in
bsp.c */
PAbt_Addr: .word UNDEF_Routine /* defined in bsp.c
*/
DAbt_Addr: .word UNDEF_Routine /* defined in bsp.c
*/
irq_addr: .word OS_CPU_IRQ_ISR
fiq_addr: .word OS_CPU_FIQ_ISR
/* ----------------------------
* LPC21xx stacks setup
* ----------------------------
*/
Reset_Handler:
ldr r0, STACK_START
/* FIQ mode stack */
msr CPSR_c, #FIQ_MODE|IRQ_DISABLE|FIQ_DISABLE
mov sp, r0
sub r0, r0, #FIQ_STACK_SIZE
/* IRQ mode stack */
msr CPSR_c, #IRQ_MODE|IRQ_DISABLE|FIQ_DISABLE
mov sp, r0
sub r0, r0, #IRQ_STACK_SIZE
/* Supervisor mode stack */
msr CPSR_c, #SVC_MODE|IRQ_DISABLE|FIQ_DISABLE
mov sp, r0
sub r0, r0, #SVC_STACK_SIZE
/* Undefined mode stack */
msr CPSR_c, #UND_MODE|IRQ_DISABLE|FIQ_DISABLE
mov sp, r0
sub r0, r0, #UND_STACK_SIZE
/* Abort mode stack */
msr CPSR_c, #ABT_MODE|IRQ_DISABLE|FIQ_DISABLE
mov sp, r0
sub r0, r0, #ABT_STACK_SIZE
/* System mode stack */
/* msr CPSR_c, #SYS_MODE|IRQ_DISABLE|FIQ_DISABLE */
msr CPSR_c, #SYS_MODE
mov sp, r0
/* Leave the processor in system mode */
/* ----------------------------
* C runtime setup
* ----------------------------
*/
/* copy .data section (Copy from ROM
to RAM) */
ldr R1, =_etext
ldr R2, =_data
ldr R3, =_edata
1:
cmp R2, R3
ldrlo R0, [R1], #4
strlo R0, [R2], #4
blo 1b
/* Clear .bss section (Zero init) */
mov R0, #0
ldr R1, =_bss
ldr R2, =_ebss
2:
cmp R1, R2
strlo R0, [R1], #4
blo 2b
/* Jump to main */
bl main
/* Catch return from main */
loop: b loop
/* ----------------------------
* 32-bit constants (and storage)
* ----------------------------
*
* These 32-bit constants are used in ldr statements.
*/
/* LPC SRAM starts at 0x40000000, and there is 16Kb = 4000h */
STACK_START: .word 0x40004000
/* Linker symbols */
data_source: .word _etext
data_start: .word _data
data_end: .word _edata
bss_start: .word _bss
bss_end: .word _ebss
/* ----------------------------
* 8-bit constants
* ----------------------------
*
* These 8-bit constants are used as immediate values and offsets.
*/
/* PLL configuration */
.equ PLLCON_OFFSET, 0x0
.equ PLLCFG_OFFSET, 0x4
.equ PLLSTAT_OFFSET, 0x8
.equ PLLFEED_OFFSET, 0xC
.equ PLLCON_PLLE, (1 << 0)
.equ PLLCON_PLLC, (1 << 1)
.equ PLLSTAT_PLOCK, (1 << 10)
.equ PLLFEED1, 0xAA
.equ PLLFEED2, 0x55
.equ PLLCFG_VALUE, 0x23
/* MAM configuration */
.equ MAMCR_OFFSET, 0x0
.equ MAMTIM_OFFSET, 0x4
.equ MAMCR_VALUE, 0x2 /* fully enabled */
.equ MAMTIM_VALUE, 0x4 /* fetch cycles */
/* Stack configuration */
/* Processor modes (see pA2-11 ARM-ARM) */
.equ FIQ_MODE, 0x11
.equ IRQ_MODE, 0x12
.equ SVC_MODE, 0x13 /* reset mode */
.equ ABT_MODE, 0x17
.equ UND_MODE, 0x1B
.equ SYS_MODE, 0x1F
/* Stack sizes */
.equ FIQ_STACK_SIZE, 0x00000080 /* 32x32-bit words */
.equ IRQ_STACK_SIZE, 0x00000080
.equ SVC_STACK_SIZE, 0x00000080
.equ ABT_STACK_SIZE, 0x00000010 /* 4x32-bit words */
.equ UND_STACK_SIZE, 0x00000010
.equ SYS_STACK_SIZE, 0x00000400 /* 256x32-bit words */
/* CPSR interrupt disable bits */
.equ IRQ_DISABLE, (1 << 7)
.equ FIQ_DISABLE, (1 << 6)
.end
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
I do the PLL and MAM init in the init c code
some of the code in the start.s need to me removed
Now I can get on with the project feeding pigs.
Thanks for your help
Regards
Jean-Jacques
--- In l..., David Hawkins wrote:
>
> Hi Jean-Jacques,
>
> > I have now got a startup code that works with initialisation code
>
> Could you please post what you needed to fix, thanks.
>
> Dave
>
Reply by ●October 18, 20072007-10-18
> This is the startup code I modified to use now
Thanks, I'll look through it to find the differences.
> Now I can get on with the project feeding pigs.
>
> Thanks for your help
No problem.
I'll take some bacon, please.
:)
Thanks, I'll look through it to find the differences.
> Now I can get on with the project feeding pigs.
>
> Thanks for your help
No problem.
I'll take some bacon, please.
:)
Reply by ●October 19, 20072007-10-19
Hi Dave
Which other versions of UCOS-II you have used
Regards
Jean-Jacques
--- In l..., Kenneth Crudup wrote:
> On Wed, 17 Oct 2007, David Hawkins wrote:
>
> > I'd been meaning to look at the WinAVR linker files to
> > see how they do it ... I seem to recall being able
> > to set a processor type and having things 'taken care of'.
>
> Probably pre-defined tables.
>
> -Kenny
>
> --
> Kenneth R. Crudup Sr. SW Engineer, Scott County Consulting, Los
Angeles
> O: 3630 S. Sepulveda Blvd. #138, L.A., CA 90034-6809 (888) 454-
8181
>
Which other versions of UCOS-II you have used
Regards
Jean-Jacques
--- In l..., Kenneth Crudup wrote:
> On Wed, 17 Oct 2007, David Hawkins wrote:
>
> > I'd been meaning to look at the WinAVR linker files to
> > see how they do it ... I seem to recall being able
> > to set a processor type and having things 'taken care of'.
>
> Probably pre-defined tables.
>
> -Kenny
>
> --
> Kenneth R. Crudup Sr. SW Engineer, Scott County Consulting, Los
Angeles
> O: 3630 S. Sepulveda Blvd. #138, L.A., CA 90034-6809 (888) 454-
8181
>
Reply by ●October 19, 20072007-10-19
Hi Dave
I have now got ten tasks running with this code without this init
code in the start.s
It would be interesting to find out why this is
I will be happy to send this code to you which is yours to to see
what is the problem
if I can get this code to work with yagarto tools chain that would be
great.
I have manage to to this with other projects
Regards
Jean-Jacques
--- In l..., David Hawkins wrote:
> > /* LPC SRAM starts at 0x40000000, and there is 32Kb = 8000h */
> > STACK_START: .word 0x40008000
>
> If your processor has less SRAM, then you'd better
> make sure your stack pointer is located appropriately.
>
> Here I've stuck it at the end of memory. You'd want
> to make sure you did the same.
>
> Cheers,
> Dave
>
I have now got ten tasks running with this code without this init
code in the start.s
It would be interesting to find out why this is
I will be happy to send this code to you which is yours to to see
what is the problem
if I can get this code to work with yagarto tools chain that would be
great.
I have manage to to this with other projects
Regards
Jean-Jacques
--- In l..., David Hawkins wrote:
> > /* LPC SRAM starts at 0x40000000, and there is 32Kb = 8000h */
> > STACK_START: .word 0x40008000
>
> If your processor has less SRAM, then you'd better
> make sure your stack pointer is located appropriately.
>
> Here I've stuck it at the end of memory. You'd want
> to make sure you did the same.
>
> Cheers,
> Dave
>
Reply by ●October 28, 20072007-10-28
Hi Dave
I have now got it all working OK now with V2.83
Thanks for your help
Can we re-publish the port?
Regards
Jean-Jacques
_____
From: l... [mailto:l...] On Behalf Of
David Hawkins
Sent: 17 October 2007 23:36
To: l...
Subject: Re: [lpc2000] Re: Micrium UCOS-II
Hi Kenny,
> I've been using the linker script to "ensure" (to the extent that it
> appears impossible, unfortunately, to use relative LENGTH directives
> in MEMORY sections) this:
Yeah, I'd wanted to find a way to use the linker script,
or some form of parameter that I could place in the Makefile
to generate the RAM size, and then stack location.
I'd been meaning to look at the WinAVR linker files to
see how they do it ... I seem to recall being able
to set a processor type and having things 'taken care of'.
But alas, LPCs and AVRs are playthings for me, and I've
had no time to play with them.
Maybe I'll get to play with your technique, or maybe we'll
get to see some of the other options people use to make their
linker/startup code independent of the processor memory size.
Cheers,
Dave
I have now got it all working OK now with V2.83
Thanks for your help
Can we re-publish the port?
Regards
Jean-Jacques
_____
From: l... [mailto:l...] On Behalf Of
David Hawkins
Sent: 17 October 2007 23:36
To: l...
Subject: Re: [lpc2000] Re: Micrium UCOS-II
Hi Kenny,
> I've been using the linker script to "ensure" (to the extent that it
> appears impossible, unfortunately, to use relative LENGTH directives
> in MEMORY sections) this:
Yeah, I'd wanted to find a way to use the linker script,
or some form of parameter that I could place in the Makefile
to generate the RAM size, and then stack location.
I'd been meaning to look at the WinAVR linker files to
see how they do it ... I seem to recall being able
to set a processor type and having things 'taken care of'.
But alas, LPCs and AVRs are playthings for me, and I've
had no time to play with them.
Maybe I'll get to play with your technique, or maybe we'll
get to see some of the other options people use to make their
linker/startup code independent of the processor memory size.
Cheers,
Dave