📜 ⬆️ ⬇️

We raise Linux on MIPSfpga and Altera FPGA

KDPV


The documentation provided by Imagination Technologies on MIPSfpga describes very well the Linux deployment in great detail. But the system used on the chip is built using Xilinx-specific peripheral modules. Therefore, its repetition on the debug board with Altera FPGA in its original form is impossible. The solution is a system on a MIPSfpga-plus chip with its platform-independent peripherals. How to run Linux on it, read in this article.


Introduction


Immediately, we note that the configuration obtained as a result of the actions described below is far from ideal. At the moment there is no boot from external media, and only UART and GPIO can be mentioned among supported devices. Therefore, the front of further work on the development of the MIPSfpga-plus system is very broad.
Further it is assumed that the reader:



In the described case, the following configuration is used:



If you are planning to seriously and deeply immerse yourself in the magic of the Linux kernel, it is strongly recommended that you familiarize yourself with the materials [ L7 ], in particular, with the presentations [ L8 ] and [ L9 ].
If all the listed requirements are met, let's start!


Synthesis of configuration and programming of FPGA



Kernel and RAM build


It is assumed that further actions are performed on the machine running Linux.



RAM disk settings



Loading the kernel into memory and running



Boot log
 Linux version 4.12.1+ (stas@ubuntu) (gcc version 4.9.2 (Codescape GNU Tools 2016.05-06 for MIPS MTI Linux) ) #1 Sat Jul 22 14:35:05 MSK 2017 CPU0 revision is: 00019e60 (MIPS M14KEc) MIPS: machine is terasic,de10lite Determined physical RAM map: memory: 04000000 @ 00000000 (usable) Initrd not found or empty - disabling initrd Primary instruction cache 4kB, VIPT, 2-way, linesize 16 bytes. Primary data cache 4kB, 2-way, VIPT, no aliases, linesize 16 bytes Zone ranges: Normal [mem 0x0000000000000000-0x0000000003ffffff] Movable zone start for each node Early memory node ranges node 0: [mem 0x0000000000000000-0x0000000003ffffff] Initmem setup node 0 [mem 0x0000000000000000-0x0000000003ffffff] Built 1 zonelists in Zone order, mobility grouping on. Total pages: 16256 Kernel command line: console=ttyS0,115200 PID hash table entries: 256 (order: -2, 1024 bytes) Dentry cache hash table entries: 8192 (order: 3, 32768 bytes) Inode-cache hash table entries: 4096 (order: 2, 16384 bytes) Memory: 60512K/65536K available (1830K kernel code, 99K rwdata, 320K rodata, 944K init, 185K bss, 5024K reserved, 0K cma-reserved) NR_IRQS:8 clocksource: MIPS: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 38225208935 ns sched_clock: 32 bits at 50MHz, resolution 20ns, wraps every 42949672950ns Console: colour dummy device 80x25 Calibrating delay loop... 10.81 BogoMIPS (lpj=21632) pid_max: default: 32768 minimum: 301 Mount-cache hash table entries: 1024 (order: 0, 4096 bytes) Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes) devtmpfs: initialized clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 7645041785100000 ns futex hash table entries: 256 (order: -1, 3072 bytes) clocksource: Switched to clocksource MIPS random: fast init done workingset: timestamp_bits=30 max_order=14 bucket_order=0 Serial: 8250/16550 driver, 4 ports, IRQ sharing disabled console [ttyS0] disabled b0400000.serial: ttyS0 at MMIO 0xb0401000 (irq = 0, base_baud = 3125000) is a 16550A console [ttyS0] enabled Freeing unused kernel memory: 944K This architecture does not have kernel memory protection. mount: mounting devpts on /dev/pts failed: No such device mount: mounting tmpfs on /dev/shm failed: Invalid argument mount: mounting tmpfs on /tmp failed: Invalid argument mount: mounting tmpfs on /run failed: Invalid argument Starting logging: OK Initializing random number generator... done. Starting network: ip: socket: Function not implemented ip: socket: Function not implemented FAIL Welcome to MIPSfpga mipsfpga login: 

Work with GPIO


Let's use the Linux capabilities in order to control the peripherals that are available to us (at the time of writing this article is a GPIO, though not fully):



What's next


The described configuration is, in fact, only the beginning of porting Linux to the MIPSfpga-plus system. To the number of works that must be performed so that the system can be used normally for practical tasks, include:



Thanks


The author is grateful to the team of translators from David Harris and Sarah Harris, Digital Circuit Design and Computer Architecture [ L1 ], by Imagination Technologies for their academic license for a modern processor core and educational materials, as well as personally for Yuri Panchulu YuriPanchul for his work on promoting MIPSfpga.


Links


[L1] - Digital circuit design and computer architecture
[L2] - How to start working with MIPSfpga ;
[L3] - MIPSfpga-plus project on github ;
[L4] - MIPSfpga and in-circuit debugging ;
[L5] - MIPSfpga and SDRAM. Part 1 ;
[L6] - MIPSfpga and UART ;
[L7] - Free Electrons. Free training materials and conference presentations ;
[L8] - Free Electrons. Embedded Linux system development course ;
[L9] - Free Electrons. Linux kernel and driver development course ;
[L10] - Patches for buildroot and Linux, required for deployment on MIPSfpga-plus .


')

Source: https://habr.com/ru/post/333920/


All Articles