home kinesia products products
Embedded Linux Information

  1. Building the 2.4.x Kernel Basics
  2. Network Configuration
  3. Developing Applications and Modules for uClinux 2.4.x
  4. Connection between Linux PC and 44B0X Target Board
  5. LCD Configuration
  6. Audio Configuration
  7. Sharp ARM 9 Root FS with FC
  8. Modifying SDL-1.2.11 to support USB mouse for ARM

Developing Applications and Modules for uClinux 2.4.x

by Tong Lai Yu and Felix Lo, July 2005

 
Developing Applications

Consider a simple example.

  1. Make directory /uClinux-dist/user/tong and go to that directory.

  2. Create file tongdemo.c:
    #include <stdlib.h>
    #include <stdio.h>
    
    int main( void )
    {
      printf("\nHello, Ocean Unicorn!\n");
      return 0;
    }
    
  3. Create Makefile:
    EXEC = tongdemo
    OBJS = tongdemo.o
    
    CFLAGS += -I.
    
    all: $(EXEC)
    
    $(EXEC): $(OBJS)
            $(CC) $(LDFLAGS) -o $@ $(OBJS) $(LDLIBS)
    
    romfs:
            $(ROMFSINST) /bin/$(EXEC)
    
    clean:
            -rm -f $(EXEC) *.elf *.gdb *.o
    
    
    You may test if your file could compile properly using make.

  4. Edit /uClinux-dist/user/Makefile:

    Add the following statment:

    dir_$(CONFIG_USER_TONG_TONGDEMO)            += tong
    

  5. Edit /uClinux-dist/config/config.in:

    Add the following:

    mainmenu_option next_comment
    comment 'Application of Tong'
    
    bool 'tongdemo' CONFIG_USER_TONG_TONGDEMO
    
    endmenu
    

  6. Execute make Menuconfig:

    Choose [*] Customize Vendor/User Settings (NEW)

    In Application of Tong ---> , choose [*] tongdemo

  7. Make the kernel and in the EV board, executing the command tongdemo should give you the message: Hello, Ocean Unicorn!

Developing modules

Consier a simple example:

  1. Go to directory /uClinux-dist/linux-2.4.x/arch/armnommu/mach-s3c44b0.

  2. Create file hellomodule.c:
    #include <linux/kernel.h>
    #include <linux/module.h>
    #include <linux/init.h>
    
    static int __init hello_init(void)
    {
            printk("Hello world from OU\n");
            return 0;
    }
    
    static void __exit hello_exit(void)
    {
            printk("Byebye from OU\n");
    }
    
    module_init(hello_init);
    module_exit(hello_exit);
    EXPORT_NO_SYMBOLS;
    

  3. Simply make the kernel and the module should be automatically loaded when the kernel is loaded to the 44B0X EV board; we should see the message "Hello World from OU".

    If we have included in the kernel the applications ( commands ), lsmod, insmod, rmmod, then we should see something upon executing the commands. However, we have not succeeded in this part yet.

    ?Alternatively, we may need to enable the modules selection ( in make menuconfig ), and "make modules", "make modules_install" ...