marqs85 / ossc

Open Source Scan Converter
http://junkerhq.net/xrgb/index.php/OSSC
GNU General Public License v3.0
480 stars 65 forks source link

Userdata import from SD card #18

Closed megari closed 5 years ago

megari commented 6 years ago

Needs more testing. Only compile-tested after rebasing to current release branch.

One thing of note is that importing userdata and upgrading the firmware are similar operations in that blocks are copied verbatim from an SD card to the Flash memory onboard the OSSC, so a function to do just that task was factored out and made both use it.

To save memory, there is only minimal validation of the userdata to be loaded. However, 512 bytes have been intentionally left reserved for a header with a checksum.

megari commented 6 years ago

Rebased on top of current release branch.

megari commented 5 years ago

Rebased on top of rv-integration.

megari commented 5 years ago

Please note that the rebased code has only been compile-tested.

megari commented 5 years ago

There seems to be quite a bit of space left even after this patch set:

Info: Building ../sys_controller_bsp/
make --no-print-directory -C ../sys_controller_bsp/
[BSP build complete]
Info: Linking sys_controller.elf
riscv64-unknown-elf-g++ -Wl,--gc-sections --specs=nano.specs -nostartfiles -T'link.riscv.ld' -L../sys_controller_bsp/  -Wl,-Map=sys_controller.map  -DENABLE_AUDIO  -Os  -Wall -Wno-unused-but-set-variable -Wno-unused-variable -Wno-unused-function -fdata-sections -ffunction-sections -fshort-enums -fgnu89-inline  -march=rv32imc -mabi=ilp32  -o sys_controller.elf obj/default/it6613/EDID.o obj/default/it6613/HDMI_TX.o obj/default/it6613/hdmitx_nios2.o obj/default/it6613/it6613.o obj/default/it6613/it6613_drv.o obj/default/it6613/it6613_sys.o obj/default/memory/flash.o obj/default/memory/sdcard.o obj/default/ossc/av_controller.o obj/default/ossc/avconfig.o obj/default/ossc/controls.o obj/default/ossc/firmware.o obj/default/ossc/menu.o obj/default/ossc/userdata.o obj/default/ossc/utils.o obj/default/pcm1862/pcm1862.o obj/default/spi_charlcd/lcd.o obj/default/ths7353/ths7353.o obj/default/tvp7002/tvp7002.o obj/default/tvp7002/video_modes.o obj/default/ulibSD/sd_io.o obj/default/ulibSD/spi_io.o obj/default/crt0.boot.o -lm -l:libhal_bsp.a
   text    data     bss     dec     hex filename
  27963    2272    2181   32416    7ea0 sys_controller.elf
riscv64-unknown-elf-objcopy --change-addresses -0x10000 -O binary --gap-fill 0 sys_controller.elf mem_init/sys_onchip_memory2_0.bin
../../tools/bin2hex mem_init/sys_onchip_memory2_0.bin mem_init/sys_onchip_memory2_0.hex
size: 30236 bytes