Application Development 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: Create a new vendor/target in the Distribution Divide your application into Kernel and Userland Components Create a test directory for kernel experiments Create a user/test directory for userland experiments Use Modules for Kernel Experiments Use FTP (File Transfer Protocol) to transfer modules and user tasks to the Target Build test cases for all Kernel and User code Transfer to the final kernel and user land layout as the design progresses Keep in a very safe place all working configurations. New Vendor/Target 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. Divide Kernel and Userland 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 Task , Kernel , User Root File System , , * Kernel Config , * , High Speed Data Input , * , Data Source Config and Setup , , * Network Driver , * , Data Transfer , ? , ? 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 (Direct Memory Access) Test Program Validate and Format Data , Part Kernel Part User Space Package Output Packet , Create a Kernel Test Directory 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 User Test Directory 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 Use Kernel Modules 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 should have the kernelLoadable Modulesconfiguration option set. FTP Target Transfer You can send updates to the target using FTP (File Transfer Protocol) instead of always downloading a new image. On the target set up the ethernet device: ifconfig eth0 On the host, start the ftp service. Use root as a login name and uClinux as a password: ftp Connected to 220 blackfin FTP server (GNU inetutils 1.4.1) ready. Name ( 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- 230- 230- 230 User root logged in. Remote system type is UNIX. Using binary mode to transfer files. ftp> Keep Working Configurations 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 )