This section presents a framework for developing uClinux applications. For instructions on how to compile and run a simple “Hello World” example, please see this section. Instructions on adding your application to the uClinux memory image can be found here.
Here is a summary of the steps:
The uClinux Distribution contains a large number of different architectures, each architecture also defines different target systems.
The Development system automatically detects the vendors and target systems available by scanning the vendors directory. Simply creating a new vendor name as a subdirectory of uClinux-dist/vendors will create a new vendor choice in the first level menu. Each vendor will have a subdirectory for each different target system they offer.
To create your own system simple follow the instructions in the vendors page.
When planning a project identify the components that will probably lie in kernel space and userland.
There may be some overlap in that applications could lie in either area at first.
Make a list and partition the project
|Root File System||*|
|High Speed Data Input||*|
|Data Source Config and Setup||*|
You may use different project teams to design kernel and user code.
Define each task as small sub components
|High Speed Data Input||Notes|
|Define I/O Pins||Refer to HW diagram|
|Dma Data to Memory||Write DMA Test Program|
|Validate and Format Data||Part Kernel Part User Space|
|Package Output Packet|
Create a test directory for your initial kernel experiments:
cd uClinux-dist mkdir linux-2.6.x/drivers/char/test
Then add this directory to the drivers/char/Makefile:
CONFIG_CHAR_TEST = y obj-$(CONFIG_CHAR_TEST) += test/
Then create a simple drivers/char/test/Makefile:
CONFIG_CHAR_TESTDMA = y obj-$(CONFIG_CHAR_TESTDMA) += test-dma.o
This will automatically build the test-dma.c code into the kernel.
Create a test directory for your initial user experiment:
cd uClinux-dist mkdir user/test
Add your code ( hello.c for example ) into the uClinux-dist/user/test directory.
Copy the uClinux-dist/user/ping/Makefile into the uClinux-dist/user/test directory and modify it by replacing ping with hello ( in this example ):
# simple hello makefile EXEC = hello OBJS = hello.o all: $(EXEC) $(EXEC): $(OBJS) $(CC) $(LDFLAGS) -o $@ $(OBJS) $(LDLIBS$(LDLIBS_$@)) romfs: $(ROMFSINST) /bin/$(EXEC) clean: -rm -f $(EXEC) *.elf *.gdb *.o
Using Kernel Modules will speed up driver development. If you are careful in your system design you will be able to insmod and rmmod the module without having to reload and reboot the kernel.
Changing the linux-2.6.x/drivers/char/Makefile to
CONFIG_CHAR_TESTDMA = m obj-$(CONFIG_CHAR_TESTDMA) += test-dma.o
Will turn your test driver into a module.
The system make will automatically build modules and place them in the correct location in the target root file system.
You can send updates to the target using FTP instead of always downloading a new image. On the target set up the ethernet device:
ifconfig eth0 192.168.1.200
On the host, start the ftp service. Use root as a login name and uClinux as a password:
ftp 192.168.1.200 Connected to 192.168.1.200. 220 blackfin FTP server (GNU inetutils 1.4.1) ready. Name (192.168.1.200:philwil): root 331 Password required for root. Password: 230- 230- Welcome to: 230- ____ _ _ 230- / __| ||_| _ _ 230- _ _| | | | _ ____ _ _ \ \/ / 230- | | | | | | || | _ \| | | | \ / 230- | |_| | |__| || | | | | |_| | / \ 230- | ___\____|_||_|_| |_|\____|/_/\_\ 230- |_| 230- 230- For further information see: 230- http://www.uclinux.org/ 230- http://blackfin.uclinux.org/ 230- 230 User root logged in. Remote system type is UNIX. Using binary mode to transfer files. ftp>
Once you have something working use the option under make menuconfig to save the configuration settings:
Type "make menuconfig" Select **Kernel/Library/Defaults Selection --->** Select **[*] Update Default Vendor Settings** Then **exit-exit-yes**
Then consider keeping an exact copy of the vendor target settings:
cd uClinux-dist mkdir archive tar cvzf archive/MyTarget-09092005-1.tar.gz vendors/MySystem/MyTarget ( change the date and version as needed )