Reply by David Hawkins October 29, 20072007-10-29
Hi Jean-Jacques,

> Would you like me to send you the relevant code modules etc

Sure, just send them to me directly, off-list.

That way I can compare the code to the original. Perhaps
I'll create another example where the MAM setup etc is
moved into C code.

I left it in the startup code as it put the microcontroller
into 'top-speed' before clearing memory.

Cheers,
Dave

An Engineer's Guide to the LPC2100 Series

Reply by jdauchot October 29, 20072007-10-29
Hi Dave

I am using a olimex LPC-2294 demo board

> So the only thing you needed to change was that small
> section of startup code, is that correct?

Yes, I used some other startup module from other examples

I have removed the PLL and MAM code out off the startup and placed it
in the C code initalisation module

I have added some code in the very start of the start.s to initialise
the 2294 external memory configuartion so that all my memory
variables can be mapped to external memory before the main code
starts. I ran out of memory (16K). Only the Stack pointers are now in
internal ram.

I have used your test4.c example and added loads of other tasks.
I am running two timers, 1ms timer0 for my I/O interface and 10ms
timer1 for the task switching. All interrupts are running using IRQ
including UART0 interrupts.

I had to move to V2.83 because the version from the book was unstable
for some reasons.

Would you like me to send you the relevant code modules etc

Regards

Jean-Jacques
--- In l..., David Hawkins wrote:
>
> Hi Jean-Jacques,
>
> > I have now got it all working OK now with V2.83
> >
> > Thanks for your help
> >
> > Can we re-publish the port?
>
> Sure. But first I should rebuild the examples and update
> the documentation.
>
> I'll setup my laptop and take the keil board home tonight
> to retest.
>
> So the only thing you needed to change was that small
> section of startup code, is that correct?
>
> I'll take a look in the ARM reference manual and see what
> the slight difference was in the startup instructions you
> ended up using.
>
> Did you ever create a small example that exhibited the
> problem? It probably had to do with an empty section in
> the elf file, however, without a specific example, I can't
> be sure. If you don't have any example code that exhibits
> the problem, I'll see if I can break one of the example.
>
> Thanks,
> Dave
>
Reply by David Hawkins October 29, 20072007-10-29
Hi Jean-Jacques,

> I have now got it all working OK now with V2.83
>
> Thanks for your help
>
> Can we re-publish the port?

Sure. But first I should rebuild the examples and update
the documentation.

I'll setup my laptop and take the keil board home tonight
to retest.

So the only thing you needed to change was that small
section of startup code, is that correct?

I'll take a look in the ARM reference manual and see what
the slight difference was in the startup instructions you
ended up using.

Did you ever create a small example that exhibited the
problem? It probably had to do with an empty section in
the elf file, however, without a specific example, I can't
be sure. If you don't have any example code that exhibits
the problem, I'll see if I can break one of the example.

Thanks,
Dave
Reply by Jean-Jacques Dauchot 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
Reply by jdauchot 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
>
Reply by jdauchot 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
>
Reply by David Hawkins 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.

:)
Reply by jdauchot 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
>
Reply by David Hawkins 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
Reply by jdauchot 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