ThinkCore W311/321/341 Linux User’s Manual Programmer’s Guide
6-2
Flash Memory Map
Partition sizes are hard coded into the kernel binary. To change the partition sizes, you will need to
rebuild the kernel. The flash memory map is shown in the following table.
Address Size Contents
0x00000000 – 0x0003FFFF 256 KB Boot Loader—Read ONLY
0x00040000 – 0x001FFFFF 1.8 MB Kernel object code—Read ONLY
0x00200000 – 0x009FFFFF 8 MB Root file system (JFFS2) —Read ONLY
0x00A00000 – 0x00FFFFFF 6 MB User directory (JFFS2) —Read/Write
Mount the user file system to /mnt/usrdisk with the root file system. Check to see if the user file
system was mounted correctly. If user file system is okay, the kernel will change the root file
system to /mnt/usrdisk. If the user file system is not okay, the kernel will use the default Moxa
file system. To finish boot process, run the init program.
NOTE 1. The default Moxa file system only enables the network and CF. It lets users recover the user
file system when it fails.
2. The user file system is a complete file system. Users can create and delete directories and
files (including source code and executable files) as needed.
3. Users can create the user file system on the PC host or target platform, and then copy it to
the W311/321/341.
4. To improve system performance, we strongly recommend that you install your application
programs on the on-board flash. However, since the on-board flash has a fixed amount of
free memory space, you must not over-write it, and instead use an external storage card,
such as an SD or CF card, for the data log.
Device API
The W311/321/341 support control devices with the ioctl system API. You will need to include
<moxadevice.h>
, and use the following ioctl function.
int ioctl(int d, int request,…);
Input: int d - open device node return file handle
int request – argument in or out
Use the desktop Linux’s man page for detailed documentation:
#man ioctl
RTC (Real Time Clock)
The device node is located at /dev/rtc. The W311/321/341 support Linux standard simple RTC
control. You must
include <linux/rtc.h>.
1. Function: RTC_RD_TIME
int ioctl(fd, RTC_RD_TIME, struct rtc_time *time);
Description: read time information from RTC. It will return the value on argument 3.
2. Function: RTC_SET_TIME
int ioctl(fd, RTC_SET_TIME, struct rtc_time *time);
Description: set RTC time. Argument 3 will be passed to RTC.