MCF537x - ( LTIB - uClinux - BSP ) Kernel Startup Questions ( seems simple isn't it ? )

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

MCF537x - ( LTIB - uClinux - BSP ) Kernel Startup Questions ( seems simple isn't it ? )

2,564 Views
osanz
Contributor I

Hello to everyone...

 

I'm working in a custom board ( partialy ) based  on LOGICPD m537xEVB board.

After many troubles and difficults, we have our own board partially working with linux, but still there are some minor ( ! ) dificults that we can not overcome.

 

1 - First we need to change ( redirect, etc.. ) the default serial port ( console ) from UART0 to UART2.

At first sigth seems easy because you can set the console device by setting on the kcl command line from bootloader ( dBUG in this case... ), but this setting does not change the serial port from the kernel early boot, this is done late when almost the entire system is running. So we loose all the debug information from the kernekl start-up.

It's supoosedto be a temporal buffer where the 'printk' stores the text if there no console device but in our case this is not true, because if we set the console to UART2, these lines never are printed on ANY UART.

 

Any IDEA????? we need just to know where the 537x is first, first is set, or where the default port, not in linux side, is set.

 

2 - This seems more easy; I need to change the loading order for linux services, because i want to automatize a cifs mount via fstab, but as the 'network' is loaded after 'filesystems' the fist attempt fails. Of course after boot, a simple 'mount -a' does the job without problems!!!!

 

I have tried to change the order position of 'network' service at 'rc.conf' to put before 'filesystems' but when i compile via ./ltib the file is set to it's defaults so my modification is lost.

 

Also i have tried to modify the position in sysconfig.lkc without success..... compiling the kernel leaves all unchanged....

 

What i can do???

 

3 - Finally i have problems compiling the 'libusb' package: ( as on many others...)

 

m68k-uclinux-gcc -shared  .libs/usb.o .libs/error.o .libs/descriptors.o .libs/linux.o   -Wl,-soname -Wl,libusb-0.1.so.4 -o .libs/libusb-0.1.so.4.4.0
/opt/freescale/usr/local/gcc-4.2.47-uclibc-0.9.47/m68k-uclinux/m68k-uclinux/libc/usr/lib/crt1.o: In function `_start':
(.text+0x1c): undefined reference to `main'

 

...note that other packages are properly compiled and updated from GPP automatically...

 

Ok, thats all. 

Thank's a lot!!

 

BR

Oscar.

Labels (1)
0 Kudos
4 Replies

528 Views
fsl_linux_spt
Contributor III

I realized that I did not respond to libusb question.

 

It looks like libusb is not supported for uclinux targtets in LTIB.  Many of the packages available in LTIB are not tested to build or run on each bsp.  Only the packages selected by default in a bsp are considered tested and known to work.  Most of the time the other packages work, but sometimes they do not.  LTIB targets both mmu-full (linux) and mmu-less (uclinux) bsps.  The uclinux bsps have fewer packages that will build and run from the general LTIB package list.  Libusb is not a package that is enabled in the bsp by default and it is no longer presented as an option in more recent LTIB uclinux targeted bsps. 

0 Kudos

528 Views
osanz
Contributor I

Hello,

 

I have some solution, but i had no time for post... sorry:

 

Regarding the #1, UART redirection i finally have done by modifying the file 'mcf.c'.

Basically is need to 'force' to use the UART2 when the system is starting up:

First is need to configure the GPIO pins for this UART, because on this uP UART2 is not the default

function; I have done like this:

 

static void mcf_config_port(struct uart_port *port, int flags)
{
    port->type = PORT_MCF;

    printk("MK36->mcf_config_port( line= %d )\n", port->line );
   
   
if( port->line == 2 )
    {       
        MCF_GPIO_PAR_TIMER = ( 0 | MCF_GPIO_PAR_TIMER_PAR_TIN2(1) | MCF_GPIO_PAR_TIMER_PAR_TIN3(1) );
        MCF_GPIO_PDDR_UART = ( 0 | MCF_GPIO_PDDR_UART_PDDR_UART6 );       
    }

   
    /* Clear mask, so no surprise interrupts. */
    writeb(0, port->membase + MCFUART_UIMR);

    if (request_irq(port->irq, mcf_interrupt, IRQF_DISABLED, "UART", port))
        printk(KERN_ERR "MCF: unable to attach ColdFire UART %d "
            "interrupt vector=%d\n", port->line, port->irq);
}

 

Then force the UART channel:

 

static int __init mcf_console_setup(struct console *co, char *options)
{
    struct uart_port *port;
    int baud = CONFIG_SERIAL_MCF_BAUDRATE;
    int bits = 8;
    int parity = 'n';
    int flow = 'n';

    if ((co->index >= 0) && (co->index <= MCF_MAXPORTS))
        co->index = 0;
       
    co->index = 2;   
   
       
    port = &mcf_ports[co->index].port;
    if (port->membase == 0)
        return -ENODEV;

    printk("mcf_console_setup( port= %d )\n", co->index ); //To see it on startup...

    if (options)
        uart_parse_options(options, &baud, &parity, &bits, &flow);

    return uart_set_options(port, co, baud, parity, bits, flow);
}

 

Also check on 'linux/arch/m68knommu/platform/537x/config.c' the interrupts are properly set for UART2.

 

I think that's all, but note that this is working on  "ltib-cf_nommu-20081215" not on "ltib-m537xevb-20071109". The new release is set by default to use "mcf.c" driver, while the previous one is set by default to "mfcserial.c".

 

Regarding the #2:

 

There is no posible combination ( i have not found ) to do this by setting the startup order.

Because a strange problem i have on the current distribution ( see  http://forums.freescale.com/freescale/board/message?board.id=CFCOMM&message.id=6925#M6925 ) i have found a good way to setup the board without scripts; put it on inittab !!!

 

This is my inittab file:

 

console::sysinit:/bin/mount -n -t proc proc /proc
console::sysinit:/bin/mount -n -t sysfs sys /sys
console::sysinit:/sbin/ifconfig eth0 xxx.xxx.xxx.xxx

console::sysinit:/bin/mount -a
::respawn:-/bin/sh
::ctrlaltdel:/sbin/reboot
::shutdown:/etc/rc.d/rcS stop
::restart:/sbin/init

 

Also note that  mount -a  Is using 'fstab' config where i can mount a network unit via CIFS, very useful on a board without samba or ftp server support!!! ( hey yaffs2* on a 2k block NAND!!! )

 

fstab lines:

 

//xxx.xxx.xxx.xxx/PROGRAMS        /debug    cifs    rw,username=xxxx,password=xxxx    0     0
/dev/mtdblock1    /newdir/nand1                yaffs        defaults                    0                0
/dev/mtdblock2    /newdir/nand2                yaffs        defaults                    0                0

 

yaffs2*: Is need to patch 'yaffs_ObjectHeader' struct on 'ysffs_guts.h' by adding a dummy WORD:

 

typedef struct {

...

    /* isShrink applies to object headers written when we shrink the file (ie resize) */
    __u32 isShrink;
    __u16 dummy;                <------ DUMMY WORD!!!

} yaffs_ObjectHeader;

 

I have found it on a forum but don't remember where....

 


Regarding the #3:

Really is no need to use libusb at all. But note that on 'ltib-m537xevb-20071109'  USB system simply does not work.

 

I suggest to upgrade to "ltib-cf_nommu-20081215" ,under this distribution USB is working fine

( well.. i only have tested with some USB mouse, and some flash pen ).

 

BUT:

ltib-cf_nommu-20081215, under some unknown conditions, CAN NOT EXECUTE SCRIPTS??????? 

 

I already have posted this question at:

http://forums.freescale.com/freescale/board/message?board.id=CFCOMM&message.id=6925#M6925.

 

 

I hope this can help some one!

 

BR;

Oscar Sanz.

 

 

 

 

 

 

0 Kudos

528 Views
fsl_linux_spt
Contributor III

1. I am not 100% sure how to get the early boot messages to show up in your UART2.  That is a good question to post to the uclinux mailing list.  Here is a link that may be useful as well.

http://www.linux.it/~rubini/docs/sercons/sercons.html

 

2. To add custom files you can use the merge directory.  there is typically a ltib_install/config/platform/platform_name/merge directory that you can place customized files in.  If there is not one you can create it and the put your new rc.conf in merge/etc/rc.d

 

 

0 Kudos

528 Views
admin
Specialist II

Hi Oscar,

 

I'm having a similar problem to your point 2) - i want to add some startup commands to /etc/rc.local but every time i run ltib --configure to generate images for my MPC8315E-RBD eval board, it resets this file back to defaults, and i'm not sure where those defaults are stored. Did you ever resolve this issue ?

 

Thanks

Rob 

0 Kudos