The project contains source code that runs on board and tools/scripts that can be used to convert the source code to proper format:
bootromfolder contains programs that will be pre-initialized in bootrom, whose entry point is0xBFC00000. The output will be afilename.coefile, which can be used in the customization of Block RAM IP.ramfolder contains programs that are intened to be written to SRAM, whose entry point is0x80000000. By design, the final output of a program are two files:filename.base.binandfilename.ext.bin. You should write it to two slies of SRAM respectively by offset 0. The output ofbootrom/boot_from_mem.sshould be used in bootrom in order to jump to the entry point of SRAM.func_testcontains functional tests from Loongsonperf_testcontains performance tests from Loongson
Endianness MATTERS! --Harry
The CPU itself is little-endian, that is, the most significant byte is the one with the highest address. As for initialization files, coe and mem files put MSB on the leftmost side, so 0x12345678 will still be 12345678 in these files. For little-endian binary memory files, it will be 0x78 0x56 0x34 0x12, and xxd will show it as 78563412. The compiler and linker should be set in Big Endian mode (-EL) when compiling from assembly or C/C++ code.
The converter from bin to mem we use does the following work on each line of the given file:
- read 4 bytes (
0x78 0x56 0x34 0x12) - write it out in reverse sequence (
12345678)