This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

compiler issue

hello all,
i have one arm7 kit of lpc2148. and one IDE is provided with it, its name is SCARM,
i have written one simple program of led on-off in SCARM and downloaded it and it is working fine.
When i wrote the same program in keil, and i included its header file and startup file. compilation is successful.but when i downloaded the file in same board it is not responding.
i want to solve this problem. is it because of startup file or something else?
and i want to use keil as SCARM code size is restricted to only 2Kbyte.
pls help me
thank you

Parents
  • hello again,
    thanks for reply. yes the site is same.
    here is startup file for LPC2148 in keil:

    and another startup.asm for SCARM

    /*
            startup.asm
            Revison 1.1, dated 9 August 2005.
    */
    
    .section .text
    .code 32
    @.globl vectors
    
    vectors:
            b reset                 @ Reset
            b .                     @ Undefined instruction
            b .                     @ SWI
            b .                     @ Prefetch abort
            b .                     @ Data abort
            b .                     @ reserved vector
    @ The following instruction should transfer control to
    @ the vector corresponding to ISR of IRQ
    @ Most ARM micro-controllers include a built-in
    @ Interrupt Controller. One example is the LPC2138.
    @ It includes the VIC interrupt controller.
    @ It will automatically put appropriate jump address
    @ into the register "VICVectAddr" - provided the VIC
    @ is configured appropriately by the user.
    @ So the following instruction simply copies the contents
    @ of "VICVectAddr" into PC.
    @ This instruction is appropriate, if you are using
    @ LPC2138 micro-controller (or it's cousins)
    @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
    @ NOTE: You may need to change the following instruction
    @ to make it work correctly for other ARM micro-controllers.
    @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
            ldr     pc,[pc,#-0xFF0] @ irqs (to VICVectAddr)
            b .                     @ fast irqs
    
    
    reset:
    @ clear .bss section
            ldr r1, bss_start
            ldr r2, bss_end
            ldr r3, =0
    
    clear_bss:
            cmp r1,r2
            strne r3,[r1],#+4
            bne clear_bss
    
    do_init:
            ldr     r1,initdata_start       @ start address of init table
            ldr     r2,initdata_end         @ end address of init table
    do1init:cmp     r1,r2
            bhs     init_done
            ldr     r0,[r1],#4      @ destination address
            ldr     r3,[r1],#4      @ number of bytes to copy
    copy_loop:
            ldrb    r4,[r1],#1      @ read 1 byte from source
            strb    r4,[r0],#1      @ write 1 byte to destination
            subs    r3,r3,#1
            bne     copy_loop
    @ now align the address in R1 to 4 bytes boundry
            add     r1,r1,#3
            and     r1,r1,#~3
            b       do1init
    init_done:
    @ init sp for supervisor (default) mode
            ldr     r13,stack_pointer
    
    @ init sp for IRQ mode
            mrs     r0,cpsr
            bic     r1,r0,#0x1F
            orr     r1,r1,#0x012    @ IRQ mode= 0x12
            msr     cpsr_c,r1
            ldr     r13,irq_stack
    
    @  enable IRQs & return to supervisor mode
            bic     r0,r0,#0x80     @ cpsr[7]=IRQ disable flag
            msr     cpsr_c,r0
    
    @ run C program
    
            bl main
    
    here:   b here
    
    stack_pointer:  .word   _stack_top
    irq_stack:      .word   _irq_stack_top
    bss_start:      .word   __bss_start__
    bss_end:        .word   __bss_end__
    initdata_start: .word   __initdata_start__
    initdata_end:   .word   __initdata_end__
            .end
    
    
    


    pls help.
    and my c code is:

    #include <stdio.h>
    #include "LPC2148.h"
    #include "mainhdr.h"
    
    
    
    int main(void) { // init_pll(); // init_mam(); // init_vpb(); init_port();
    while(1) { IO0SET = 0xffffffff; // delay(5000);
    // IO0CLR = 0xffffffff; // delay(5000);
    }
    } /* void init_pll(void) { //system clock //PLLCFG = 0x00100100; //p=2 (PSEL=01) and m=5-1 (MSEL=00100) PLL0CFG = 0x22; //48Mhz m = 4-1 = 3 i.e 00010 // PLLCFG = 0x23; //60Mhz m=5-1=4 i.e 00011 PLL0CON = 0x01;
    PLL0FEED = 0xaa; PLL0FEED = 0x55;
    while((PLL0STAT & 0x400) == 0);
    PLL0CON = 0x03;
    PLL0FEED = 0xaa; PLL0FEED = 0x55;
    //usb clock //PLL48CFG = 0x00100011; //p=2 (PSEL=01) and m=4-1 (MSEL=00011) PLL1CFG = 0x23; PLL1CON = 0x01;
    PLL1FEED = 0xaa; PLL1FEED = 0x55;
    while((PLL1STAT & 0x400) == 0);
    PLL1CON = 0x03;
    PLL1FEED = 0xaa; PLL1FEED = 0x55; } */ void init_mam(void) { MAMTIM = 0x00000001; MAMCR = 0x02; }
    void init_vpb(void) { VPBDIV = 0x01; }
    void init_port(void) { SCS = 0x00000000; PINSEL0 = 0x00000000; //all gpio IO0DIR = 0xffffffff; //p0.15 as output IO0CLR = 0xffffffff; //p0.15 = 1 }
    void delay(uint a) { uint i,j; for(i=0;i<a;i++) { j = 0; } }

Reply
  • hello again,
    thanks for reply. yes the site is same.
    here is startup file for LPC2148 in keil:

    and another startup.asm for SCARM

    /*
            startup.asm
            Revison 1.1, dated 9 August 2005.
    */
    
    .section .text
    .code 32
    @.globl vectors
    
    vectors:
            b reset                 @ Reset
            b .                     @ Undefined instruction
            b .                     @ SWI
            b .                     @ Prefetch abort
            b .                     @ Data abort
            b .                     @ reserved vector
    @ The following instruction should transfer control to
    @ the vector corresponding to ISR of IRQ
    @ Most ARM micro-controllers include a built-in
    @ Interrupt Controller. One example is the LPC2138.
    @ It includes the VIC interrupt controller.
    @ It will automatically put appropriate jump address
    @ into the register "VICVectAddr" - provided the VIC
    @ is configured appropriately by the user.
    @ So the following instruction simply copies the contents
    @ of "VICVectAddr" into PC.
    @ This instruction is appropriate, if you are using
    @ LPC2138 micro-controller (or it's cousins)
    @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
    @ NOTE: You may need to change the following instruction
    @ to make it work correctly for other ARM micro-controllers.
    @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
            ldr     pc,[pc,#-0xFF0] @ irqs (to VICVectAddr)
            b .                     @ fast irqs
    
    
    reset:
    @ clear .bss section
            ldr r1, bss_start
            ldr r2, bss_end
            ldr r3, =0
    
    clear_bss:
            cmp r1,r2
            strne r3,[r1],#+4
            bne clear_bss
    
    do_init:
            ldr     r1,initdata_start       @ start address of init table
            ldr     r2,initdata_end         @ end address of init table
    do1init:cmp     r1,r2
            bhs     init_done
            ldr     r0,[r1],#4      @ destination address
            ldr     r3,[r1],#4      @ number of bytes to copy
    copy_loop:
            ldrb    r4,[r1],#1      @ read 1 byte from source
            strb    r4,[r0],#1      @ write 1 byte to destination
            subs    r3,r3,#1
            bne     copy_loop
    @ now align the address in R1 to 4 bytes boundry
            add     r1,r1,#3
            and     r1,r1,#~3
            b       do1init
    init_done:
    @ init sp for supervisor (default) mode
            ldr     r13,stack_pointer
    
    @ init sp for IRQ mode
            mrs     r0,cpsr
            bic     r1,r0,#0x1F
            orr     r1,r1,#0x012    @ IRQ mode= 0x12
            msr     cpsr_c,r1
            ldr     r13,irq_stack
    
    @  enable IRQs & return to supervisor mode
            bic     r0,r0,#0x80     @ cpsr[7]=IRQ disable flag
            msr     cpsr_c,r0
    
    @ run C program
    
            bl main
    
    here:   b here
    
    stack_pointer:  .word   _stack_top
    irq_stack:      .word   _irq_stack_top
    bss_start:      .word   __bss_start__
    bss_end:        .word   __bss_end__
    initdata_start: .word   __initdata_start__
    initdata_end:   .word   __initdata_end__
            .end
    
    
    


    pls help.
    and my c code is:

    #include <stdio.h>
    #include "LPC2148.h"
    #include "mainhdr.h"
    
    
    
    int main(void) { // init_pll(); // init_mam(); // init_vpb(); init_port();
    while(1) { IO0SET = 0xffffffff; // delay(5000);
    // IO0CLR = 0xffffffff; // delay(5000);
    }
    } /* void init_pll(void) { //system clock //PLLCFG = 0x00100100; //p=2 (PSEL=01) and m=5-1 (MSEL=00100) PLL0CFG = 0x22; //48Mhz m = 4-1 = 3 i.e 00010 // PLLCFG = 0x23; //60Mhz m=5-1=4 i.e 00011 PLL0CON = 0x01;
    PLL0FEED = 0xaa; PLL0FEED = 0x55;
    while((PLL0STAT & 0x400) == 0);
    PLL0CON = 0x03;
    PLL0FEED = 0xaa; PLL0FEED = 0x55;
    //usb clock //PLL48CFG = 0x00100011; //p=2 (PSEL=01) and m=4-1 (MSEL=00011) PLL1CFG = 0x23; PLL1CON = 0x01;
    PLL1FEED = 0xaa; PLL1FEED = 0x55;
    while((PLL1STAT & 0x400) == 0);
    PLL1CON = 0x03;
    PLL1FEED = 0xaa; PLL1FEED = 0x55; } */ void init_mam(void) { MAMTIM = 0x00000001; MAMCR = 0x02; }
    void init_vpb(void) { VPBDIV = 0x01; }
    void init_port(void) { SCS = 0x00000000; PINSEL0 = 0x00000000; //all gpio IO0DIR = 0xffffffff; //p0.15 as output IO0CLR = 0xffffffff; //p0.15 = 1 }
    void delay(uint a) { uint i,j; for(i=0;i<a;i++) { j = 0; } }

Children