├── firmware ├── UnoCart.bin ├── UnoCart.elf ├── PlusCart.bin ├── PlusCart.elf ├── PlusCart_Duo.bin ├── PlusCart_Duo.elf ├── UnoCart_Zero.bin ├── UnoCart_Zero.elf ├── PlusCart_Zero.bin └── PlusCart_Zero.elf ├── source ├── Atari2600ROM │ ├── font.bin │ ├── PlusCart.bin │ └── Makefile ├── ElfTests │ ├── debug │ │ ├── vcsMock.a │ │ ├── makefile │ │ ├── debug.c │ │ ├── vcsLib.h │ │ └── stm32f4_flash.ld │ ├── raycaster │ │ ├── overblank.h │ │ ├── vcsMock.a │ │ ├── assets.h │ │ ├── makefile │ │ ├── mathf32.c │ │ ├── mathf32.h │ │ ├── vcsLib.h │ │ ├── raycaster.c │ │ └── stm32f4_flash.ld │ ├── region │ │ ├── vcsMock.a │ │ ├── makefile │ │ ├── region.c │ │ ├── vcsLib.h │ │ └── stm32f4_flash.ld │ ├── rom-elf │ │ ├── vcsMock.a │ │ ├── 4k_rom.bin │ │ ├── cartridge_io_mock.a │ │ ├── makefile │ │ ├── cartridge_io.h │ │ ├── rom_elf.c │ │ ├── vcsLib.h │ │ └── stm32f4_flash.ld │ ├── vcsMock │ │ ├── makefile │ │ └── vcsMock.c │ └── cartridge_io_mock │ │ ├── makefile │ │ └── cartridge_io_mock.c └── STM32firmware │ └── PlusCart │ ├── Inc │ ├── xxd.exe │ ├── plusCart_PAL.bin │ ├── plusCart_NTSC.bin │ ├── plusCart_PAL60.bin │ ├── cartridge_emulation_ar.h │ ├── cartridge_emulation_ELF.h │ ├── cartridge_emulation_sb.h │ ├── cartridge_emulation_ACE.h │ ├── cartridge_emulation_3F.h │ ├── convert.bat │ ├── cartridge_emulation_bf.h │ ├── cartridge_emulation_df.h │ ├── cartridge_setup.h │ ├── cartridge_io.h │ ├── stm32_udid.h │ ├── cartridge_detection.h │ ├── cartridge_firmware.h │ ├── user_diskio.h │ ├── user_diskio_spi.h │ ├── fatfs.h │ ├── supercharger_bios.h │ ├── stm32f4xx_it.h │ ├── md5.h │ ├── elfLib.h │ ├── flash.h │ ├── main.h │ ├── firmware_pal_rom.h │ ├── firmware_pal60_rom.h │ ├── firmware_uno_pal_rom.h │ ├── firmware_uno_pal60_rom.h │ ├── esp8266.h │ ├── firmware_ntsc_rom.h │ └── firmware_uno_ntsc_rom.h │ ├── Drivers │ ├── CMSIS │ │ ├── Device │ │ │ └── ST │ │ │ │ └── STM32F4xx │ │ │ │ └── Include │ │ │ │ ├── stm32f4xx.h │ │ │ │ └── system_stm32f4xx.h │ │ └── Include │ │ │ ├── cmsis_version.h │ │ │ └── tz_context.h │ └── STM32F4xx_HAL_Driver │ │ ├── License.md │ │ └── Inc │ │ ├── stm32f4xx_hal_flash_ramfunc.h │ │ └── stm32f4xx_hal_dma_ex.h │ ├── .settings │ ├── stm32cubeide.project.prefs │ ├── org.eclipse.cdt.core.prefs │ └── language.settings.xml │ ├── Src │ ├── cartridge_io.c │ ├── about.txt │ ├── cartridge_emulation_sb.c │ ├── sysmem.c │ ├── cartridge_emulation_df.c │ ├── cartridge_emulation_bf.c │ ├── cartridge_emulation_ELF.c │ ├── cartridge_emulation_3F.c │ ├── syscalls.c │ ├── user_diskio.c │ ├── cartridge_setup.c │ └── stm32f4xx_it.c │ ├── Middlewares │ └── Third_Party │ │ └── FatFs │ │ └── src │ │ ├── integer.h │ │ ├── diskio.h │ │ ├── ff_gen_drv.h │ │ ├── ff_gen_drv.c │ │ ├── diskio.c │ │ └── option │ │ └── syscall.c │ └── .project ├── pcbs ├── PlusCart │ └── PlusCart gerber.zip └── unified-smd-pcb │ ├── LICENSE-HOWTO.pdf │ └── README.md ├── .gitignore └── README.md /firmware/UnoCart.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Al-Nafuur/United-Carts-of-Atari/HEAD/firmware/UnoCart.bin -------------------------------------------------------------------------------- /firmware/UnoCart.elf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Al-Nafuur/United-Carts-of-Atari/HEAD/firmware/UnoCart.elf -------------------------------------------------------------------------------- /firmware/PlusCart.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Al-Nafuur/United-Carts-of-Atari/HEAD/firmware/PlusCart.bin -------------------------------------------------------------------------------- /firmware/PlusCart.elf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Al-Nafuur/United-Carts-of-Atari/HEAD/firmware/PlusCart.elf -------------------------------------------------------------------------------- /firmware/PlusCart_Duo.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Al-Nafuur/United-Carts-of-Atari/HEAD/firmware/PlusCart_Duo.bin -------------------------------------------------------------------------------- /firmware/PlusCart_Duo.elf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Al-Nafuur/United-Carts-of-Atari/HEAD/firmware/PlusCart_Duo.elf -------------------------------------------------------------------------------- /firmware/UnoCart_Zero.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Al-Nafuur/United-Carts-of-Atari/HEAD/firmware/UnoCart_Zero.bin -------------------------------------------------------------------------------- /firmware/UnoCart_Zero.elf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Al-Nafuur/United-Carts-of-Atari/HEAD/firmware/UnoCart_Zero.elf -------------------------------------------------------------------------------- /firmware/PlusCart_Zero.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Al-Nafuur/United-Carts-of-Atari/HEAD/firmware/PlusCart_Zero.bin -------------------------------------------------------------------------------- /firmware/PlusCart_Zero.elf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Al-Nafuur/United-Carts-of-Atari/HEAD/firmware/PlusCart_Zero.elf -------------------------------------------------------------------------------- /source/Atari2600ROM/font.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Al-Nafuur/United-Carts-of-Atari/HEAD/source/Atari2600ROM/font.bin -------------------------------------------------------------------------------- /pcbs/PlusCart/PlusCart gerber.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Al-Nafuur/United-Carts-of-Atari/HEAD/pcbs/PlusCart/PlusCart gerber.zip -------------------------------------------------------------------------------- /source/Atari2600ROM/PlusCart.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Al-Nafuur/United-Carts-of-Atari/HEAD/source/Atari2600ROM/PlusCart.bin -------------------------------------------------------------------------------- /source/ElfTests/debug/vcsMock.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Al-Nafuur/United-Carts-of-Atari/HEAD/source/ElfTests/debug/vcsMock.a -------------------------------------------------------------------------------- /source/ElfTests/raycaster/overblank.h: -------------------------------------------------------------------------------- 1 | void overblank(unsigned char but1, unsigned char joy1, uint8_t colors[40], uint32_t systemType); -------------------------------------------------------------------------------- /source/ElfTests/region/vcsMock.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Al-Nafuur/United-Carts-of-Atari/HEAD/source/ElfTests/region/vcsMock.a -------------------------------------------------------------------------------- /source/ElfTests/rom-elf/vcsMock.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Al-Nafuur/United-Carts-of-Atari/HEAD/source/ElfTests/rom-elf/vcsMock.a -------------------------------------------------------------------------------- /source/ElfTests/raycaster/vcsMock.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Al-Nafuur/United-Carts-of-Atari/HEAD/source/ElfTests/raycaster/vcsMock.a -------------------------------------------------------------------------------- /source/ElfTests/rom-elf/4k_rom.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Al-Nafuur/United-Carts-of-Atari/HEAD/source/ElfTests/rom-elf/4k_rom.bin -------------------------------------------------------------------------------- /pcbs/unified-smd-pcb/LICENSE-HOWTO.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Al-Nafuur/United-Carts-of-Atari/HEAD/pcbs/unified-smd-pcb/LICENSE-HOWTO.pdf -------------------------------------------------------------------------------- /source/ElfTests/rom-elf/cartridge_io_mock.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Al-Nafuur/United-Carts-of-Atari/HEAD/source/ElfTests/rom-elf/cartridge_io_mock.a -------------------------------------------------------------------------------- /source/ElfTests/vcsMock/makefile: -------------------------------------------------------------------------------- 1 | vcsMock: vcsMock.c 2 | arm-none-eabi-gcc -r -mlong-calls -fno-exceptions -march=armv7-m *.c -ovcsMock.a -O2 -Wall 3 | -------------------------------------------------------------------------------- /source/STM32firmware/PlusCart/Inc/xxd.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Al-Nafuur/United-Carts-of-Atari/HEAD/source/STM32firmware/PlusCart/Inc/xxd.exe -------------------------------------------------------------------------------- /source/STM32firmware/PlusCart/Inc/plusCart_PAL.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Al-Nafuur/United-Carts-of-Atari/HEAD/source/STM32firmware/PlusCart/Inc/plusCart_PAL.bin -------------------------------------------------------------------------------- /source/STM32firmware/PlusCart/Inc/plusCart_NTSC.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Al-Nafuur/United-Carts-of-Atari/HEAD/source/STM32firmware/PlusCart/Inc/plusCart_NTSC.bin -------------------------------------------------------------------------------- /source/STM32firmware/PlusCart/Inc/plusCart_PAL60.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Al-Nafuur/United-Carts-of-Atari/HEAD/source/STM32firmware/PlusCart/Inc/plusCart_PAL60.bin -------------------------------------------------------------------------------- /source/ElfTests/cartridge_io_mock/makefile: -------------------------------------------------------------------------------- 1 | cartridge_io_mock: cartridge_io_mock.c 2 | arm-none-eabi-gcc -r -mlong-calls -fno-exceptions -march=armv7-m *.c -ocartridge_io_mock.a -O2 -Wall 3 | -------------------------------------------------------------------------------- /source/STM32firmware/PlusCart/Drivers/CMSIS/Device/ST/STM32F4xx/Include/stm32f4xx.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Al-Nafuur/United-Carts-of-Atari/HEAD/source/STM32firmware/PlusCart/Drivers/CMSIS/Device/ST/STM32F4xx/Include/stm32f4xx.h -------------------------------------------------------------------------------- /source/ElfTests/region/makefile: -------------------------------------------------------------------------------- 1 | region: region.c 2 | arm-none-eabi-gcc -r -mlong-calls -fno-exceptions -march=armv7-m *.c -oregion.bin -O2 -Wall 3 | arm-none-eabi-strip region.bin -d -R.comment -R.ARM.attributes 4 | arm-none-eabi-ld region.bin vcsMock.a -oregion-linked.elf -Tstm32f4_flash.ld 5 | -------------------------------------------------------------------------------- /source/STM32firmware/PlusCart/Inc/cartridge_emulation_ar.h: -------------------------------------------------------------------------------- 1 | #ifndef CARTRIDGE_EMULATION_AR_H 2 | #define CARTRIDGE_EMULATION_AR_H 3 | 4 | void emulate_ar_cartridge(const char* filename, unsigned int image_size, uint8_t *buffer, int tv_mode, MENU_ENTRY *d ); 5 | 6 | #endif // CARTRIDGE_EMULATION_AR_H 7 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /source/STM32firmware/PlusCart/PlusCart 2 | /source/STM32firmware/PlusCart/PlusCart Zero 3 | /source/STM32firmware/PlusCart/PlusCart Duo 4 | /source/STM32firmware/PlusCart/UnoCart 5 | /source/STM32firmware/PlusCart/UnoCart Zero 6 | /source/STM32firmware/PlusCart/.settings/language.settings.xml 7 | -------------------------------------------------------------------------------- /source/STM32firmware/PlusCart/.settings/stm32cubeide.project.prefs: -------------------------------------------------------------------------------- 1 | 2F62501ED4689FB349E356AB974DBE57=9D7FB4C21999F3FAB2A305AF14D26BE7 2 | 8DF89ED150041C4CBC7CB9A9CAA90856=9D7FB4C21999F3FAB2A305AF14D26BE7 3 | DC22A860405A8BF2F2C095E5B6529F12=5D54C5BC82E5D96ADA0540FBA1F0207B 4 | eclipse.preferences.version=1 5 | -------------------------------------------------------------------------------- /source/STM32firmware/PlusCart/.settings/org.eclipse.cdt.core.prefs: -------------------------------------------------------------------------------- 1 | doxygen/doxygen_new_line_after_brief=true 2 | doxygen/doxygen_use_brief_tag=false 3 | doxygen/doxygen_use_javadoc_tags=true 4 | doxygen/doxygen_use_pre_tag=false 5 | doxygen/doxygen_use_structural_commands=false 6 | eclipse.preferences.version=1 7 | -------------------------------------------------------------------------------- /source/ElfTests/raycaster/assets.h: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #define MapWidth 40 4 | #define MapHeight 40 5 | 6 | const unsigned char reverseByte[256]; 7 | 8 | const int SineLookup[128]; 9 | 10 | int8_t map[MapWidth][MapHeight]; 11 | 12 | extern uint8_t heights[40]; 13 | extern uint8_t colors[40]; 14 | -------------------------------------------------------------------------------- /source/ElfTests/raycaster/makefile: -------------------------------------------------------------------------------- 1 | raycaster: raycaster.c 2 | arm-none-eabi-gcc -r -mlong-calls -fno-exceptions -march=armv7-m *.c -oraycaster.bin -O2 -Wall 3 | arm-none-eabi-strip raycaster.bin -d -R.comment -R.ARM.attributes 4 | arm-none-eabi-ld raycaster.bin vcsMock.a -oraycaster-linked.elf -Tstm32f4_flash.ld 5 | -------------------------------------------------------------------------------- /source/Atari2600ROM/Makefile: -------------------------------------------------------------------------------- 1 | all: plus.bin 2 | 3 | 4 | plus.bin: *.asm Makefile FORCE 5 | osascript -e 'quit app "Stella"' 6 | ../../../dasm/bin/dasm PlusCart.asm -lPlusCart.lst -f3 -oPlusCart.bin 7 | cp ./PlusCart.bin ~/NextCloud/My\ ROMs 8 | open -a /Applications/Stella.app ./PlusCart.bin 9 | 10 | 11 | FORCE: 12 | -------------------------------------------------------------------------------- /pcbs/unified-smd-pcb/README.md: -------------------------------------------------------------------------------- 1 | Unified PlusCart UnoCart SMD PCB 2 | =============== 3 | 4 | based on Randy Glenn's Unocart2600 PCB 5 | https://github.com/rglenn/unocart2600-pcb 6 | 7 | migrated to KiCAD 6 and PlusCart WiFi module ESP8266 added by Wolfgang Stubig 8 | 9 | Licensed under CERN OHL 1.2. See LICENSE.txt for more information. -------------------------------------------------------------------------------- /source/STM32firmware/PlusCart/Inc/cartridge_emulation_ELF.h: -------------------------------------------------------------------------------- 1 | #ifndef CARTRIDGE_ELF_H 2 | #define CARTRIDGE_ELF_H 3 | 4 | #include "stm32f4xx_hal_tim.h" 5 | #include "cartridge_io.h" 6 | #include "elfLib.h" 7 | 8 | // ELF File 9 | int launch_elf_file(const char* filename, uint32_t buffer_size, uint8_t *buffer); 10 | 11 | #endif // CARTRIDGE_ELF_H 12 | -------------------------------------------------------------------------------- /source/STM32firmware/PlusCart/Inc/cartridge_emulation_sb.h: -------------------------------------------------------------------------------- 1 | #ifndef CARTRIDGE_EMULATION_SB_H 2 | #define CARTRIDGE_EMULATION_SB_H 3 | 4 | #include 5 | 6 | /* SB SUPERBanking */ 7 | 8 | void emulate_SB_cartridge(const char* filename, uint32_t image_size, uint8_t* buffer, MENU_ENTRY *d); 9 | 10 | #endif // CARTRIDGE_EMULATION_SB_H 11 | -------------------------------------------------------------------------------- /source/STM32firmware/PlusCart/Drivers/STM32F4xx_HAL_Driver/License.md: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2016 STMicroelectronics 2 | 3 | This software component is licensed by STMicroelectronics under the **BSD-3-Clause** license. You may not use this file except in compliance with this license. You may obtain a copy of the license [here](https://opensource.org/licenses/BSD-3-Clause). -------------------------------------------------------------------------------- /source/ElfTests/cartridge_io_mock/cartridge_io_mock.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | volatile uint16_t* const ADDR_IDR = (volatile uint16_t* const)0x40000010; 4 | volatile uint8_t* const DATA_IDR = (volatile uint8_t* const)0x40000020; 5 | volatile uint8_t* const DATA_ODR = (volatile uint8_t* const)0x40000030; 6 | volatile uint16_t* const DATA_MODER = (volatile uint16_t* const)0x40000040; -------------------------------------------------------------------------------- /source/STM32firmware/PlusCart/Inc/cartridge_emulation_ACE.h: -------------------------------------------------------------------------------- 1 | #ifndef CARTRIDGE_ACE_H 2 | #define CARTRIDGE_ACE_H 3 | 4 | int launch_ace_cartridge(const char* filename, uint32_t image_size, uint8_t* buffer, MENU_ENTRY *d,int header_length, bool withPlusFunctions, uint32_t *CCMPTR); 5 | 6 | int is_ace_cartridge(unsigned int image_size, uint8_t *buffer); 7 | 8 | #endif // CARTRIDGE_ACE_H 9 | -------------------------------------------------------------------------------- /source/ElfTests/rom-elf/makefile: -------------------------------------------------------------------------------- 1 | rom_elf: rom_elf.c 2 | arm-none-eabi-gcc -r -mlong-calls -fno-exceptions -march=armv7-m *.c -orom_elf.o -O2 -Wall 3 | arm-none-eabi-ld -r rom_elf.o -b binary 4k_rom.bin -orom_elf.bin 4 | arm-none-eabi-strip rom_elf.bin -d -R.comment -R.ARM.attributes 5 | arm-none-eabi-ld rom_elf.bin vcsMock.a cartridge_io_mock.a -orom_elf-linked.elf -Tstm32f4_flash.ld 6 | -------------------------------------------------------------------------------- /source/STM32firmware/PlusCart/Inc/cartridge_emulation_3F.h: -------------------------------------------------------------------------------- 1 | #ifndef CARTRIDGE_EMULATION_3F_H 2 | #define CARTRIDGE_EMULATION_3F_H 3 | 4 | #include 5 | 6 | /* 3F (Tigervision) Bankswitching */ 7 | //void emulate_3F_cartridge(); 8 | 9 | void emulate_3F_cartridge(const char* filename, uint32_t image_size, uint8_t* buffer, MENU_ENTRY *d); 10 | 11 | #endif // CARTRIDGE_EMULATION_3F_H 12 | -------------------------------------------------------------------------------- /source/STM32firmware/PlusCart/Inc/convert.bat: -------------------------------------------------------------------------------- 1 | copy "plusCart_PAL.bin" firmware_pal.rom 2 | xxd -i firmware_pal.rom > firmware_pal_rom.h 3 | del firmware_pal.rom 4 | 5 | copy "plusCart_PAL60.bin" firmware_pal60.rom 6 | xxd -i firmware_pal60.rom > firmware_pal60_rom.h 7 | del firmware_pal60.rom 8 | 9 | copy "plusCart_NTSC.bin" firmware_ntsc.rom 10 | xxd -i firmware_ntsc.rom > firmware_ntsc_rom.h 11 | del firmware_ntsc.rom -------------------------------------------------------------------------------- /source/STM32firmware/PlusCart/Inc/cartridge_emulation_bf.h: -------------------------------------------------------------------------------- 1 | #ifndef CARTRIDGE_EMULATION_BF_H 2 | #define CARTRIDGE_EMULATION_BF_H 3 | 4 | #include 5 | 6 | void emulate_bf_cartridge(const char* filename, uint32_t image_size, uint8_t* buffer, MENU_ENTRY *d); 7 | 8 | void emulate_bfsc_cartridge(const char* filename, uint32_t image_size, uint8_t* buffer, MENU_ENTRY *d); 9 | 10 | #endif // CARTRIDGE_EMULATION_BF_H 11 | -------------------------------------------------------------------------------- /source/STM32firmware/PlusCart/Inc/cartridge_emulation_df.h: -------------------------------------------------------------------------------- 1 | #ifndef CARTRIDGE_EMULATION_DF_H 2 | #define CARTRIDGE_EMULATION_DF_H 3 | 4 | #include 5 | 6 | void emulate_df_cartridge(const char* filename, uint32_t image_size, uint8_t* buffer, MENU_ENTRY *d ); 7 | 8 | void emulate_dfsc_cartridge(const char* filename, uint32_t image_size, uint8_t* buffer, MENU_ENTRY *d ); 9 | 10 | #endif // CARTRIDGE_EMULATION_DF_H 11 | -------------------------------------------------------------------------------- /source/STM32firmware/PlusCart/Inc/cartridge_setup.h: -------------------------------------------------------------------------------- 1 | #ifndef CARTRIDGE_SETUP_H 2 | #define CARTRIDGE_SETUP_H 3 | 4 | #include 5 | #include 6 | 7 | #include "global.h" 8 | 9 | typedef struct { 10 | uint8_t* banks[256]; 11 | } cartridge_layout; 12 | 13 | bool setup_cartridge_image(const char*, uint32_t, uint8_t*, cartridge_layout* , MENU_ENTRY *, enum cart_base_type ); 14 | 15 | #endif // CARTRIDGE_SETUP_H 16 | -------------------------------------------------------------------------------- /source/ElfTests/debug/makefile: -------------------------------------------------------------------------------- 1 | all: debug-clock.bin debug-elapsed.bin 2 | 3 | debug-clock.bin: debug.c vcsLib.h 4 | arm-none-eabi-gcc -r -mlong-calls -fno-exceptions -march=armv7-m *.c -odebug-clock.bin -O2 -Wall -DARG_TYPE=MP_CLOCK_HZ 5 | arm-none-eabi-strip debug-clock.bin -d -R.comment -R.ARM.attributes 6 | arm-none-eabi-ld debug-clock.bin vcsMock.a -odebug-clock-linked.elf -Tstm32f4_flash.ld 7 | 8 | 9 | debug-elapsed.bin: debug.c vcsLib.h 10 | arm-none-eabi-gcc -r -mlong-calls -fno-exceptions -march=armv7-m *.c -odebug-elapsed.bin -O2 -Wall -DARG_TYPE=MP_ELAPSED 11 | arm-none-eabi-strip debug-elapsed.bin -d -R.comment -R.ARM.attributes 12 | arm-none-eabi-ld debug-elapsed.bin vcsMock.a -odebug-elapsed-linked.elf -Tstm32f4_flash.ld 13 | 14 | clean: 15 | rm *.bin -f 16 | rm *.elf -f -------------------------------------------------------------------------------- /source/STM32firmware/PlusCart/Src/cartridge_io.c: -------------------------------------------------------------------------------- 1 | #include "cartridge_io.h" 2 | 3 | // if no HARDWARE_TYPE, leave undefined for now. ELF loader will handle defining at load time 4 | #ifdef HARDWARE_TYPE 5 | #if HARDWARE_TYPE == UNOCART 6 | volatile uint8_t* const DATA_IDR = &(((uint8_t*)(&GPIOE->IDR))[1]); 7 | volatile uint8_t* const DATA_ODR = &(((uint8_t*)(&GPIOE->ODR))[1]); 8 | volatile uint16_t* const DATA_MODER = &(((uint16_t*)(&GPIOE->MODER))[1]); 9 | #elif HARDWARE_TYPE == PLUSCART 10 | #include "stm32f4xx.h" 11 | volatile uint8_t* const DATA_IDR = ((uint8_t*)(&GPIOC->IDR)); 12 | volatile uint8_t* const DATA_ODR = ((uint8_t*)(&GPIOC->ODR)); 13 | volatile uint16_t* const DATA_MODER = ((uint16_t*)(&GPIOC->MODER)); 14 | #endif 15 | volatile uint16_t* const ADDR_IDR = ((uint16_t*)(&GPIOD->IDR)); 16 | #endif 17 | 18 | 19 | uint16_t EXIT_SWCHB_ADDR = SWCHB; 20 | -------------------------------------------------------------------------------- /source/ElfTests/rom-elf/cartridge_io.h: -------------------------------------------------------------------------------- 1 | #ifndef CARTRIDGE_IO_H 2 | #define CARTRIDGE_IO_H 3 | 4 | #include 5 | 6 | // TODO DEPRECATE THESE ONCE TESTED ON BOTH UNO AND PLUS 7 | #define DATA_OUT_SHIFT 8 | #define DATA_IN_SHIFT 9 | 10 | #ifdef HARDWARE_TYPE 11 | #if HARDWARE_TYPE == UNOCART 12 | #include "stm32f4xx.h" 13 | #define CONTROL_IN GPIOC->IDR 14 | #endif 15 | #endif 16 | 17 | extern volatile uint16_t* const ADDR_IDR; 18 | extern volatile uint8_t* const DATA_IDR; 19 | extern volatile uint8_t* const DATA_ODR; 20 | extern volatile uint16_t* const DATA_MODER; 21 | 22 | #define ADDR_IN (*ADDR_IDR) 23 | #define DATA_IN (*DATA_IDR) 24 | #define DATA_IN_BYTE (*DATA_IDR & 0xFF) // TODO deprecate this 25 | #define DATA_OUT *DATA_ODR 26 | #define SET_DATA_MODE_IN *DATA_MODER = 0x0000; 27 | #define SET_DATA_MODE_OUT *DATA_MODER = 0x5555; 28 | #define SET_DATA_MODE(m) *DATA_MODER = (m); 29 | 30 | #endif // CARTRIDGE_IO_H 31 | -------------------------------------------------------------------------------- /source/STM32firmware/PlusCart/Inc/cartridge_io.h: -------------------------------------------------------------------------------- 1 | #ifndef CARTRIDGE_IO_H 2 | #define CARTRIDGE_IO_H 3 | 4 | #include 5 | 6 | #define SWCHB 0x282 7 | 8 | #ifdef HARDWARE_TYPE 9 | #if HARDWARE_TYPE == UNOCART 10 | #include "stm32f4xx.h" 11 | #define CONTROL_IN GPIOC->IDR 12 | #endif 13 | #endif 14 | 15 | extern volatile uint16_t* const ADDR_IDR; 16 | extern volatile uint8_t* const DATA_IDR; 17 | extern volatile uint8_t* const DATA_ODR; 18 | extern volatile uint16_t* const DATA_MODER; 19 | 20 | #define ADDR_IN (*ADDR_IDR) 21 | #define DATA_IN (*DATA_IDR) 22 | #define DATA_IN_BYTE (*DATA_IDR & 0xFF) // TODO deprecate this 23 | #define DATA_OUT *DATA_ODR 24 | #define SET_DATA_MODE_IN *DATA_MODER = 0x0000; 25 | #define SET_DATA_MODE_OUT *DATA_MODER = 0x5555; 26 | #define SET_DATA_MODE(m) *DATA_MODER = (m); 27 | 28 | // Used to control exit function 29 | extern uint16_t EXIT_SWCHB_ADDR; 30 | 31 | 32 | #endif // CARTRIDGE_IO_H 33 | -------------------------------------------------------------------------------- /source/STM32firmware/PlusCart/Inc/stm32_udid.h: -------------------------------------------------------------------------------- 1 | /** 2 | * A simple header for reading the STM32 unique device ID (UDID) 3 | * Tested with STM32F4 and STM32F0 families 4 | * 5 | * Version 1.0 6 | * Written by Uli Koehler 7 | * Published on http://techoverflow.net 8 | * Licensed under CC0 (public domain): 9 | * https://creativecommons.org/publicdomain/zero/1.0/ 10 | */ 11 | #ifndef STM32_UDID_H 12 | #define STM32_UDID_H 13 | #include 14 | 15 | #define FLASH_SIZE_ADDRESS 0x1FFF7A22 /* STM32F4xx flash size address */ 16 | #define UNIQUE_DEVICE_ID_ADDRESS 0x1FFF7A10 /* STM32F4xx unique device ID address */ 17 | 18 | /** 19 | * The STM32 factory-programmed UDID memory. 20 | * Three values of 32 bits each starting at this address 21 | * Use like this: STM32_UDID[0], STM32_UDID[1], STM32_UDID[2] 22 | */ 23 | #define STM32_UDID ((__IO uint32_t *) UNIQUE_DEVICE_ID_ADDRESS ) 24 | 25 | #define STM32F4_FLASH_SIZE (*(__IO uint16_t *) (FLASH_SIZE_ADDRESS)) 26 | 27 | 28 | #endif //STM32_UDID_H 29 | -------------------------------------------------------------------------------- /source/STM32firmware/PlusCart/Middlewares/Third_Party/FatFs/src/integer.h: -------------------------------------------------------------------------------- 1 | /*-------------------------------------------*/ 2 | /* Integer type definitions for FatFs module */ 3 | /*-------------------------------------------*/ 4 | 5 | #ifndef _FF_INTEGER 6 | #define _FF_INTEGER 7 | 8 | #ifdef _WIN32 /* FatFs development platform */ 9 | 10 | #include 11 | #include 12 | typedef unsigned __int64 QWORD; 13 | 14 | 15 | #else /* Embedded platform */ 16 | 17 | /* These types MUST be 16-bit or 32-bit */ 18 | typedef int INT; 19 | typedef unsigned int UINT; 20 | 21 | /* This type MUST be 8-bit */ 22 | typedef unsigned char BYTE; 23 | 24 | /* These types MUST be 16-bit */ 25 | typedef short SHORT; 26 | typedef unsigned short WORD; 27 | typedef unsigned short WCHAR; 28 | 29 | /* These types MUST be 32-bit */ 30 | typedef long LONG; 31 | typedef unsigned long DWORD; 32 | 33 | /* This type MUST be 64-bit (Remove this for ANSI C (C89) compatibility) */ 34 | typedef unsigned long long QWORD; 35 | 36 | #endif 37 | 38 | #endif 39 | -------------------------------------------------------------------------------- /source/ElfTests/rom-elf/rom_elf.c: -------------------------------------------------------------------------------- 1 | #include "vcsLib.h" 2 | #include "cartridge_io.h" 3 | 4 | // Value provided by linker when linking in 4k rom binary 5 | // Just ignore the size and end for now and assume it's a valid 4k binary blob 6 | extern uint8_t _binary_4k_rom_bin_start[]; 7 | // extern uint32_t _binary_rom_bin_size; 8 | // extern uint8_t* _binary_rom_bin_end; 9 | 10 | int elf_main() 11 | { 12 | uint16_t addr, addr_prev = 0; 13 | uint8_t* buffer = (uint8_t*)_binary_4k_rom_bin_start; 14 | uint16_t resetVector = *((uint16_t*)&buffer[0xffc]) & 0x1fff; 15 | vcsJsr6(resetVector); 16 | 17 | // Wait for the JSR to complete and put the first byte on the bus to give the driver time to get going 18 | while (ADDR_IN != resetVector) 19 | ; 20 | DATA_OUT = buffer[resetVector & 0xfff]; 21 | while (ADDR_IN == resetVector) 22 | ; 23 | 24 | while (1) 25 | { 26 | while ((addr = ADDR_IN) != addr_prev) 27 | addr_prev = addr; 28 | 29 | if (addr & 0x1000) 30 | { 31 | // A12 high 32 | DATA_OUT = buffer[addr & 0xfff]; 33 | SET_DATA_MODE_OUT; 34 | } 35 | else 36 | { 37 | SET_DATA_MODE_IN; 38 | } 39 | } 40 | return 0; 41 | } 42 | 43 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Atari 2600 PlusCart 2 | 3 | 4 | ## Description 5 | the Atari 2600 PlusCart ist based on Robin Edwards Unocart-2600 (https://github.com/robinhedwards/UnoCart-2600) and the extensions of Christian Speckner's (DirtyHairy) fork (https://github.com/DirtyHairy/UnoCart-2600). The PlusCart has no SD-Card, but an ESP8266 to connect to a local WiFi Network and the Internet. 6 | The PlusCart downloads the ROM-files from an Server in the Internet called the "PlusStore". The way this is done is similar to the way the Unocart-2600 loads ROMs from the FAT filesystem on the SD-card, while the VCS is performing a waitroutine in his RAM. 7 | 8 | ## PlusROM 9 | Additionally the PlusCart has one more interesting feature. It offers **internet access** to the ROM Developers, these functions are called "[PlusROM](http://pcart.firmaplus.de/pico/?PlusROM)". Examples for PlusROMs can be found in the [PlusROM-Hacks Repository](https://github.com/Al-Nafuur/PlusROM-Hacks) on Github. 10 | 11 | ## [Documentation](http://pcart.firmaplus.de/pico/) 12 | More information and documentation can be found at the [PlusCart website](http://pcart.firmaplus.de/pico/) 13 | 14 | 15 | Copyright: 16 | 17 | (c) Firmaplus(+) Ltd. 18 | 19 | Dipl.Ing.(FH) Wolfgang Stubig 20 | -------------------------------------------------------------------------------- /source/STM32firmware/PlusCart/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | PlusCart 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.cdt.managedbuilder.core.genmakebuilder 10 | clean,full,incremental, 11 | 12 | 13 | 14 | 15 | org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder 16 | full,incremental, 17 | 18 | 19 | 20 | 21 | 22 | com.st.stm32cube.ide.mcu.MCUProjectNature 23 | com.st.stm32cube.ide.mcu.MCUCubeProjectNature 24 | org.eclipse.cdt.core.cnature 25 | com.st.stm32cube.ide.mcu.MCUCubeIdeServicesRevAProjectNature 26 | com.st.stm32cube.ide.mcu.MCUSingleCpuProjectNature 27 | org.eclipse.cdt.managedbuilder.core.managedBuildNature 28 | org.eclipse.cdt.managedbuilder.core.ScannerConfigNature 29 | com.st.stm32cube.ide.mcu.MCUCubeIdeServicesRevAev2ProjectNature 30 | 31 | 32 | -------------------------------------------------------------------------------- /source/STM32firmware/PlusCart/Inc/cartridge_detection.h: -------------------------------------------------------------------------------- 1 | #ifndef CARTRIDGE_DETECTION_H 2 | #define CARTRIDGE_DETECTION_H 3 | 4 | 5 | 6 | int isProbablyPLS(unsigned int, unsigned char *); 7 | 8 | int isPotentialF8(unsigned int, unsigned char *); 9 | 10 | /* The following detection routines are modified from the Atari 2600 Emulator Stella 11 | (https://github.com/stella-emu) */ 12 | int isProbablySC(unsigned int, unsigned char *); 13 | int isProbablyUA(unsigned int, unsigned char *); 14 | int isProbablyFE(unsigned int, unsigned char *); 15 | int isProbably3F(unsigned int, unsigned char *); 16 | int isProbably3E(unsigned int, unsigned char *); 17 | int isProbably3EPlus(unsigned int, unsigned char *); 18 | int isProbablyE0(unsigned int, unsigned char *); 19 | int isProbably0840(unsigned int, unsigned char *); 20 | int isProbablyCV(unsigned int, unsigned char *); 21 | int isProbablyEF(unsigned int, unsigned char *); 22 | int isProbablyE7(unsigned int, unsigned char *); 23 | int isProbablyE78K(unsigned int, unsigned char *); 24 | int isProbablyBF(unsigned char *); 25 | int isProbablyBFSC(unsigned char *); 26 | int isProbablyDF(unsigned char *); 27 | int isProbablyDFSC(unsigned char *); 28 | int isProbablyDPCplus(unsigned int, unsigned char *); 29 | int isProbablySB(unsigned int, unsigned char *); 30 | 31 | #endif // CARTRIDGE_DETECTION_H 32 | -------------------------------------------------------------------------------- /source/STM32firmware/PlusCart/Src/about.txt: -------------------------------------------------------------------------------- 1 | x 2 | Author: Wolfgang Stubig 3 | 4 | Website: https://gitlab.com/ 5 | firmaplus/atari-2600-pluscart 6 | ******************************* 7 | (c)2019-2020 Wolfgang Stubig 8 | (Al_Nafuur) 9 | based on: UnoCart2600 by Robin Edwards (ElectroTrains) 10 | https://github.com/robinhedwards/UnoCart-2600 11 | and UnoCart2600 fork by Christian Speckner (DirtyHairy) 12 | https://github.com/DirtyHairy/UnoCart-2600 13 | 14 | additional programming by 15 | Andrew Davie (andrew@taswegian.com) 16 | Thomas Jentzsch (tjentszch@yahoo.de) 17 | ******************************* 18 | 19 | This program is free software: you can redistribute it and/or modify 20 | it under the terms of the GNU General Public License as published by 21 | the Free Software Foundation, either version 3 of the License, or 22 | (at your option) any later version. 23 | 24 | This program is distributed in the hope that it will be useful, 25 | but WITHOUT ANY WARRANTY; without even the implied warranty of 26 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 27 | GNU General Public License for more details. 28 | 29 | You should have received a copy of the GNU General Public License 30 | along with this program. If not, see http://www.gnu.org/licenses/. 31 | -------------------------------------------------------------------------------- /source/ElfTests/raycaster/mathf32.c: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | ; ******************************************************************** 4 | ; mathf32 5 | ; 6 | ; Fixed point math routines 7 | ; 8 | ; $Date: Sun, 24 Aug 2014 00:28:00 +0200 $ 9 | ; $Author: dietrich $ 10 | ; $Revision: 359 $ 11 | ; 12 | ; Copyright (C) 2014 Andreas Dietrich 13 | ; ******************************************************************** 14 | */ 15 | 16 | #include "mathf32.h" 17 | 18 | // 19 | // f32 fixed point type (32 bit) 20 | // 21 | // Based on code from the SGDK Genesis development kit 22 | // https://code.google.com/p/sgdk 23 | // 24 | 25 | 26 | inline Vec2f32 VecSet(f32 x, f32 y) 27 | { 28 | Vec2f32 result = {x, y}; 29 | 30 | return result; 31 | }; 32 | 33 | inline Vec2f32 VecAdd(Vec2f32 v0, Vec2f32 v1) 34 | { 35 | Vec2f32 result; 36 | 37 | result.x = F32Add(v0.x, v1.x); 38 | result.y = F32Add(v0.y, v1.y); 39 | 40 | return result; 41 | }; 42 | 43 | inline Vec2f32 VecSub(Vec2f32 v0, Vec2f32 v1) 44 | { 45 | Vec2f32 result; 46 | 47 | result.x = F32Sub(v0.x, v1.x); 48 | result.y = F32Sub(v0.y, v1.y); 49 | 50 | return result; 51 | }; 52 | 53 | inline Vec2f32 VecMul(f32 s, Vec2f32 v) 54 | { 55 | Vec2f32 result; 56 | 57 | result.x = F32Mul(s, v.x); 58 | result.y = F32Mul(s, v.y); 59 | 60 | return result; 61 | }; 62 | 63 | inline Vec2f32 VecDiv(Vec2f32 v, f32 s) 64 | { 65 | Vec2f32 result; 66 | 67 | result.x = F32Div(v.x, s); 68 | result.y = F32Div(v.y, s); 69 | 70 | return result; 71 | }; 72 | -------------------------------------------------------------------------------- /source/STM32firmware/PlusCart/Src/cartridge_emulation_sb.c: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | #include 4 | #include "cartridge_emulation.h" 5 | #include "cartridge_setup.h" 6 | #include "cartridge_emulation_sb.h" 7 | #include "cartridge_firmware.h" 8 | 9 | void emulate_SB_cartridge( const char* filename, uint32_t image_size, uint8_t* buffer, MENU_ENTRY *d ) 10 | { 11 | cartridge_layout * layout = (cartridge_layout *) malloc( sizeof( cartridge_layout )); 12 | 13 | if (!setup_cartridge_image(filename, image_size, buffer, layout, d, base_type_SB)) return; 14 | 15 | uint8_t banks = (uint8_t)(( image_size / 4096 ) - 1); 16 | uint8_t *bank = layout->banks[banks]; 17 | 18 | uint16_t addr, addr_prev = 0; 19 | uint8_t data_prev = 0, data = 0; 20 | bool joy_status = false; 21 | 22 | if (!reboot_into_cartridge()) return; 23 | __disable_irq(); // Disable interrupts 24 | 25 | while (1) 26 | { 27 | while ((addr = ADDR_IN) != addr_prev) 28 | addr_prev = addr; 29 | // got a stable address 30 | if (addr & 0x1000) 31 | { // A12 high 32 | DATA_OUT = bank[addr & 0xFFF]; 33 | SET_DATA_MODE_OUT 34 | // wait for address bus to change 35 | while (ADDR_IN == addr) ; 36 | SET_DATA_MODE_IN 37 | }else if (addr & 0x0800 ){ 38 | bank = layout->banks[addr & banks]; 39 | // wait for address bus to change 40 | while (ADDR_IN == addr) ; 41 | }else if(addr == EXIT_SWCHB_ADDR){ 42 | while (ADDR_IN == addr) { data_prev = data; data = DATA_IN; } 43 | if( !(data_prev & 0x1) && joy_status) 44 | break; 45 | }else if(addr == SWCHA){ 46 | while (ADDR_IN == addr) { data_prev = data; data = DATA_IN; } 47 | joy_status = !(data_prev & 0x80); 48 | } 49 | 50 | } 51 | exit_cartridge(addr, addr_prev); 52 | 53 | free(layout); 54 | } 55 | -------------------------------------------------------------------------------- /source/STM32firmware/PlusCart/Inc/cartridge_firmware.h: -------------------------------------------------------------------------------- 1 | #ifndef CARTRIDGE_FIRMWARE_H 2 | #define CARTRIDGE_FIRMWARE_H 3 | 4 | #include 5 | #include 6 | #include "global.h" 7 | 8 | #include "cartridge_io.h" 9 | 10 | 11 | #define CART_CMD_HOTSPOT 0x1fe6 12 | #define CART_STATUS_BYTES_START 0x1fe7 // start status bytes area 13 | #define CART_STATUS_BYTES_END CART_STATUS_BYTES_START + 6 // 7 bytes of status 14 | 15 | #define CART_CMD_ROOT_DIR 0xff // Menu waits for boot menu 16 | #define CART_CMD_PAGE_DOWN 0x10 // previous page request (page--) 17 | #define CART_CMD_PAGE_UP 0x20 // next page request (page++) 18 | #define CART_CMD_START_CART 0x30 // Menu ready for reboot into selected ROM 19 | 20 | enum TV_MODE { 21 | TV_MODE_UNKNOWN, 22 | 23 | TV_MODE_NTSC, TV_MODE_DEFAULT = 1, 24 | TV_MODE_PAL, 25 | TV_MODE_PAL60, 26 | 27 | TV_MODE_MAX 28 | 29 | }; 30 | 31 | enum FONT_TYPE { 32 | FONT_TJZ, 33 | FONT_AD, 34 | FONT_MORGAN, 35 | FONT_GLACIER, FONT_DEFAULT = 3, 36 | 37 | FONT_MAX 38 | 39 | }; 40 | 41 | enum SPACING { 42 | SPACING_DENSE, 43 | SPACING_REGULAR, SPACING_DEFAULT = 1, 44 | SPACING_SPARSE, 45 | 46 | SPACING_MAX 47 | }; 48 | 49 | void set_tv_mode(int tv_mode); 50 | 51 | int emulate_firmware_cartridge(); 52 | 53 | void set_menu_status_msg(const char* message); 54 | 55 | void createMenuForAtari(MENU_ENTRY * menu_entries, uint8_t page_id, int num_menu_entries, bool is_connected, uint8_t * plus_store_status); 56 | 57 | void set_menu_status_byte(enum eStatus_bytes_id byte_id, uint8_t status_byte); 58 | 59 | void set_tv_mode(int tv_mode); 60 | //void set_my_font(int new_font); 61 | 62 | int emulate_firmware_cartridge(); 63 | 64 | bool reboot_into_cartridge(); 65 | 66 | #endif // CARTRIDGE_FIRMWARE_H 67 | -------------------------------------------------------------------------------- /source/STM32firmware/PlusCart/Inc/user_diskio.h: -------------------------------------------------------------------------------- 1 | /* USER CODE BEGIN Header */ 2 | /** 3 | ****************************************************************************** 4 | * @file user_diskio.h 5 | * @brief This file contains the common defines and functions prototypes for 6 | * the user_diskio driver. 7 | ****************************************************************************** 8 | * @attention 9 | * 10 | *

© Copyright (c) 2021 STMicroelectronics. 11 | * All rights reserved.

12 | * 13 | * This software component is licensed by ST under Ultimate Liberty license 14 | * SLA0044, the "License"; You may not use this file except in compliance with 15 | * the License. You may obtain a copy of the License at: 16 | * www.st.com/SLA0044 17 | * 18 | ****************************************************************************** 19 | */ 20 | /* USER CODE END Header */ 21 | 22 | /* Define to prevent recursive inclusion -------------------------------------*/ 23 | #ifndef __USER_DISKIO_H 24 | #define __USER_DISKIO_H 25 | 26 | #ifdef __cplusplus 27 | extern "C" { 28 | #endif 29 | 30 | /* USER CODE BEGIN 0 */ 31 | 32 | /* Includes ------------------------------------------------------------------*/ 33 | /* Exported types ------------------------------------------------------------*/ 34 | /* Exported constants --------------------------------------------------------*/ 35 | /* Exported functions ------------------------------------------------------- */ 36 | extern Diskio_drvTypeDef USER_Driver; 37 | 38 | /* USER CODE END 0 */ 39 | 40 | #ifdef __cplusplus 41 | } 42 | #endif 43 | 44 | #endif /* __USER_DISKIO_H */ 45 | 46 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 47 | -------------------------------------------------------------------------------- /source/STM32firmware/PlusCart/Drivers/CMSIS/Include/cmsis_version.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************//** 2 | * @file cmsis_version.h 3 | * @brief CMSIS Core(M) Version definitions 4 | * @version V5.0.2 5 | * @date 19. April 2017 6 | ******************************************************************************/ 7 | /* 8 | * Copyright (c) 2009-2017 ARM Limited. All rights reserved. 9 | * 10 | * SPDX-License-Identifier: Apache-2.0 11 | * 12 | * Licensed under the Apache License, Version 2.0 (the License); you may 13 | * not use this file except in compliance with the License. 14 | * You may obtain a copy of the License at 15 | * 16 | * www.apache.org/licenses/LICENSE-2.0 17 | * 18 | * Unless required by applicable law or agreed to in writing, software 19 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 20 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 21 | * See the License for the specific language governing permissions and 22 | * limitations under the License. 23 | */ 24 | 25 | #if defined ( __ICCARM__ ) 26 | #pragma system_include /* treat file as system include file for MISRA check */ 27 | #elif defined (__clang__) 28 | #pragma clang system_header /* treat file as system include file */ 29 | #endif 30 | 31 | #ifndef __CMSIS_VERSION_H 32 | #define __CMSIS_VERSION_H 33 | 34 | /* CMSIS Version definitions */ 35 | #define __CM_CMSIS_VERSION_MAIN ( 5U) /*!< [31:16] CMSIS Core(M) main version */ 36 | #define __CM_CMSIS_VERSION_SUB ( 1U) /*!< [15:0] CMSIS Core(M) sub version */ 37 | #define __CM_CMSIS_VERSION ((__CM_CMSIS_VERSION_MAIN << 16U) | \ 38 | __CM_CMSIS_VERSION_SUB ) /*!< CMSIS Core(M) version number */ 39 | #endif 40 | -------------------------------------------------------------------------------- /source/ElfTests/region/region.c: -------------------------------------------------------------------------------- 1 | #include "vcsLib.h" 2 | 3 | const uint8_t NTSC[32] = 4 | { 5 | 0x82, 0xc2, 0xa2, 0x92, 0x8a, 0x86, 0x82, 0x00, 6 | 0xfe, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 7 | 0x7e, 0x80, 0x80, 0x7c, 0x02, 0x02, 0xfc, 0x00, 8 | 0x3e, 0x40, 0x80, 0x80, 0x80, 0x40, 0x3e, 0x00 9 | }; 10 | 11 | const uint8_t PAL[32] = 12 | { 13 | 0x7c, 0x82, 0x82, 0xfc, 0x80, 0x80, 0x80, 0x00, 14 | 0x10, 0x28, 0x44, 0xfe, 0x82, 0x82, 0x82, 0x00, 15 | 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0xfe, 0x00, 16 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 17 | }; 18 | 19 | 20 | int elf_main(uint32_t* args) 21 | { 22 | const uint8_t* pf = NTSC; 23 | // Always reset PC first, cause it's going to be close to the end of the 6507 address space 24 | vcsJmp3(); 25 | 26 | // Init TIA and RIOT RAM 27 | vcsLda2(0); 28 | for (int i = 0; i < 256; i++) { 29 | vcsSta3((unsigned char)i); 30 | } 31 | 32 | while (1) 33 | { 34 | // 3 lines of VSYNC 35 | vcsLda2(2); 36 | vcsSta3(VSYNC); 37 | for (int i = 0; i < 3; i++) { 38 | vcsSta3(WSYNC); 39 | } 40 | vcsLda2(0); 41 | vcsSta3(VSYNC); 42 | // 37 lines of VBLANK 43 | for (int i = 0; i < 37; i++) { 44 | vcsSta3(WSYNC); 45 | } 46 | if (args[MP_SYSTEM_TYPE] == ST_NTSC_2600) 47 | { 48 | pf = NTSC; 49 | } 50 | else 51 | { 52 | pf = PAL; 53 | } 54 | vcsLda2(0); 55 | vcsSta3(VBLANK); 56 | // 192 lines of COLUBK 57 | for (int i = 0; i < 32; i++) 58 | { 59 | for (int j = 0; j < 6; j++) 60 | { 61 | vcsSta3(WSYNC); 62 | vcsWrite5(COLUPF, 0xff); 63 | vcsWrite5(PF1, pf[i]); 64 | vcsJmp3(); 65 | } 66 | } 67 | 68 | vcsWrite5(VBLANK, 2); 69 | // 30 lines of Overscan 70 | for (int i = 0; i < 30; i++) { 71 | vcsSta3(WSYNC); 72 | uint8_t p0Button = vcsRead4(INPT4); 73 | if (0 == (p0Button & 0x80)) 74 | { 75 | vcsJmp3(); 76 | vcsNop2n(0xf00); 77 | return 0; 78 | } 79 | } 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /source/STM32firmware/PlusCart/Inc/user_diskio_spi.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file user_diskio_spi.h 4 | * @brief This file contains the common defines and functions prototypes for 5 | * the user_diskio_spi driver implementation 6 | ****************************************************************************** 7 | * Portions copyright (C) 2014, ChaN, all rights reserved. 8 | * Portions copyright (C) 2017, kiwih, all rights reserved. 9 | * 10 | * This software is a free software and there is NO WARRANTY. 11 | * No restriction on use. You can use, modify and redistribute it for 12 | * personal, non-profit or commercial products UNDER YOUR RESPONSIBILITY. 13 | * Redistributions of source code must retain the above copyright notice. 14 | * 15 | ****************************************************************************** 16 | */ 17 | 18 | #ifndef _USER_DISKIO_SPI_H 19 | #define _USER_DISKIO_SPI_H 20 | 21 | #include "integer.h" //from FatFs middleware library 22 | #include "diskio.h" //from FatFs middleware library 23 | #include "ff_gen_drv.h" //from FatFs middleware library 24 | 25 | //we define these as inline because we don't want them to be actual function calls (they get "called" from the cubemx autogenerated user_diskio file) 26 | //we define them as extern because they are defined in a separate .c file to user_diskio.c (which #includes this .h file) 27 | 28 | extern DSTATUS USER_SPI_initialize (BYTE pdrv); 29 | extern DSTATUS USER_SPI_status (BYTE pdrv); 30 | extern DRESULT USER_SPI_read (BYTE pdrv, BYTE *buff, DWORD sector, UINT count); 31 | #if _USE_WRITE == 1 32 | extern DRESULT USER_SPI_write (BYTE pdrv, const BYTE *buff, DWORD sector, UINT count); 33 | #endif /* _USE_WRITE == 1 */ 34 | #if _USE_IOCTL == 1 35 | extern DRESULT USER_SPI_ioctl (BYTE pdrv, BYTE cmd, void *buff); 36 | #endif /* _USE_IOCTL == 1 */ 37 | 38 | #endif 39 | -------------------------------------------------------------------------------- /source/ElfTests/raycaster/mathf32.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | ; ******************************************************************** 4 | ; mathf32 5 | ; 6 | ; Fixed point math routines 7 | ; 8 | ; $Date: Sun, 24 Aug 2014 00:28:00 +0200 $ 9 | ; $Author: dietrich $ 10 | ; $Revision: 359 $ 11 | ; 12 | ; Copyright (C) 2014 Andreas Dietrich 13 | ; ******************************************************************** 14 | */ 15 | 16 | #ifndef MATHF32_H 17 | #define MATHF32_H 18 | 19 | #include 20 | 21 | // 22 | // f32 fixed point type (32 bit) 23 | // 24 | // Based on code from the SGDK Genesis development kit 25 | // https://code.google.com/p/sgdk 26 | // 27 | 28 | typedef int32_t f32; 29 | 30 | #define F32_INT_BITS 22 31 | #define F32_FRAC_BITS (32 - F32_INT_BITS) 32 | #define F32_INT_MASK (((1 << F32_INT_BITS) - 1) << F32_FRAC_BITS) 33 | #define F32_FRAC_MASK ((1 << F32_FRAC_BITS) - 1) 34 | 35 | #define F32(value) ((f32) ((value) * (1 << F32_FRAC_BITS))) 36 | 37 | #define IntToF32(value) ((value) << F32_FRAC_BITS) 38 | #define F32ToInt(value) ((value) >> F32_FRAC_BITS) 39 | 40 | #define F32Frac(value) ((value) & F32_FRAC_MASK) 41 | #define F32Int(value) ((value) & F32_INT_MASK) 42 | 43 | #define F32Add(val1, val2) ((val1) + (val2)) 44 | #define F32Sub(val1, val2) ((val1) - (val2)) 45 | #define F32Mul(val1, val2) (((val1) * (val2)) >> F32_FRAC_BITS) 46 | #define F32Div(val1, val2) (((val1) << F32_FRAC_BITS) / (val2)) 47 | #define F32Neg(value) (0 - (value)) 48 | 49 | // 50 | // f32 fixed point 2D vector type 51 | // 52 | 53 | typedef struct 54 | { 55 | f32 x, y; 56 | 57 | } Vec2f32; 58 | 59 | Vec2f32 VecSet(f32 x, f32 y); 60 | 61 | Vec2f32 VecAdd(Vec2f32 v0, Vec2f32 v1); 62 | 63 | Vec2f32 VecSub(Vec2f32 v0, Vec2f32 v1); 64 | 65 | Vec2f32 VecMul(f32 s, Vec2f32 v); 66 | 67 | Vec2f32 VecDiv(Vec2f32 v, f32 s); 68 | 69 | #endif -------------------------------------------------------------------------------- /source/STM32firmware/PlusCart/Inc/fatfs.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file fatfs.h 4 | * @brief Header for fatfs applications 5 | ****************************************************************************** 6 | * @attention 7 | * 8 | *

© Copyright (c) 2021 STMicroelectronics. 9 | * All rights reserved.

10 | * 11 | * This software component is licensed by ST under Ultimate Liberty license 12 | * SLA0044, the "License"; You may not use this file except in compliance with 13 | * the License. You may obtain a copy of the License at: 14 | * www.st.com/SLA0044 15 | * 16 | ****************************************************************************** 17 | */ 18 | 19 | /* Define to prevent recursive inclusion -------------------------------------*/ 20 | #ifndef __fatfs_H 21 | #define __fatfs_H 22 | #ifdef __cplusplus 23 | extern "C" { 24 | #endif 25 | 26 | #include "ff.h" 27 | #include "ff_gen_drv.h" 28 | #include "user_diskio.h" /* defines USER_Driver as external */ 29 | 30 | /* USER CODE BEGIN Includes */ 31 | #include "global.h" 32 | 33 | /* USER CODE END Includes */ 34 | 35 | extern uint8_t retUSER; /* Return value for USER */ 36 | extern char USERPath[4]; /* USER logical drive path */ 37 | extern FATFS USERFatFS; /* File system object for USER logical drive */ 38 | extern FIL USERFile; /* File object for USER */ 39 | 40 | void MX_FATFS_Init(void); 41 | 42 | /* USER CODE BEGIN Prototypes */ 43 | enum sd_card_stat{ 44 | sd_card_total_size, 45 | sd_card_used_size, 46 | }; 47 | 48 | bool sd_card_file_list( char *, MENU_ENTRY **dst, int * ); 49 | uint32_t sd_card_file_request( uint8_t *, const char *, uint32_t, uint32_t ); 50 | bool sd_card_find_file( char *, char *, MENU_ENTRY **dst, int * ); 51 | int sd_card_file_size( char * ); 52 | int * sd_card_statistic(); 53 | /* USER CODE END Prototypes */ 54 | #ifdef __cplusplus 55 | } 56 | #endif 57 | #endif /*__fatfs_H */ 58 | 59 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 60 | -------------------------------------------------------------------------------- /source/STM32firmware/PlusCart/Inc/supercharger_bios.h: -------------------------------------------------------------------------------- 1 | unsigned const char supercharger_bios_bin[]__attribute__((section(".flash0"))) = { 2 | 0xa5, 0xfa, 0x85, 0x80, 0x4c, 0x18, 0xf8, 0x78, 0xd8, 0xa9, 0x00, 0xa2, 3 | 0xff, 0x9a, 0xaa, 0xa8, 0x95, 0x00, 0xe8, 0xd0, 0xfb, 0x4c, 0x18, 0xf8, 4 | 0xa2, 0x00, 0xad, 0x06, 0xf0, 0x8d, 0xf8, 0xff, 0xa0, 0x00, 0xa2, 0x28, 5 | 0x94, 0x04, 0xca, 0x10, 0xfb, 0xa9, 0x00, 0x85, 0x1b, 0x85, 0x1c, 0x85, 6 | 0x1d, 0x85, 0x1e, 0x85, 0x1f, 0x85, 0x19, 0x85, 0x1a, 0x85, 0x08, 0x85, 7 | 0x01, 0xa9, 0x10, 0x85, 0x21, 0x85, 0x02, 0xa2, 0x07, 0xca, 0xca, 0xd0, 8 | 0xfd, 0xa9, 0x00, 0x85, 0x20, 0x85, 0x10, 0x85, 0x11, 0x85, 0x02, 0x85, 9 | 0x2a, 0xa9, 0x05, 0x85, 0x0a, 0xa9, 0xff, 0x85, 0x0d, 0x85, 0x0e, 0x85, 10 | 0x0f, 0x85, 0x84, 0x85, 0x85, 0xa9, 0xf0, 0x85, 0x83, 0xa2, 0x74, 0xa9, 11 | 0x02, 0x2c, 0xfa, 0xff, 0xf0, 0x02, 0xa2, 0xd4, 0x86, 0x09, 0xa9, 0x0c, 12 | 0x85, 0x15, 0xa9, 0x1f, 0x85, 0x17, 0x85, 0x82, 0xa9, 0x07, 0x85, 0x19, 13 | 0xa2, 0x08, 0xa0, 0x00, 0x85, 0x02, 0x88, 0xd0, 0xfb, 0xa9, 0x01, 0x2c, 14 | 0xfa, 0xff, 0xf0, 0x07, 0xa0, 0x32, 0x85, 0x02, 0x88, 0xd0, 0xfb, 0x85, 15 | 0x02, 0x85, 0x02, 0xa9, 0x02, 0x85, 0x02, 0x85, 0x00, 0x85, 0x02, 0x85, 16 | 0x02, 0x85, 0x02, 0xa9, 0x00, 0x85, 0x00, 0xca, 0x10, 0xd6, 0x06, 0x83, 17 | 0x66, 0x84, 0x26, 0x85, 0xa5, 0x83, 0x85, 0x0d, 0xa5, 0x84, 0x85, 0x0e, 18 | 0xa5, 0x85, 0x85, 0x0f, 0xa6, 0x82, 0xca, 0x86, 0x82, 0x86, 0x17, 0xe0, 19 | 0x0a, 0xd0, 0xb5, 0xa9, 0x02, 0x85, 0x01, 0xa2, 0x1c, 0xa0, 0x00, 0x84, 20 | 0x19, 0x84, 0x09, 0xa2, 0x00, 0xac, 0x00, 0xf0, 0xea, 0xbc, 0x00, 0xf7, 21 | 0xe8, 0xd0, 0xf6, 0xa2, 0x0b, 0xbd, 0x26, 0xf9, 0x95, 0x81, 0xca, 0x10, 22 | 0xf8, 0xa5, 0x80, 0x4c, 0x81, 0x00, 0xa2, 0x1c, 0xa0, 0x00, 0x94, 0x81, 23 | 0xca, 0x10, 0xfb, 0xa2, 0x06, 0xbd, 0x31, 0xf9, 0x95, 0xfa, 0xca, 0x10, 24 | 0xf8, 0xae, 0xf0, 0xff, 0x86, 0x80, 0xbc, 0x00, 0xf0, 0xad, 0xf1, 0xff, 25 | 0xae, 0xf2, 0xff, 0x86, 0xfe, 0xae, 0xf3, 0xff, 0x86, 0xff, 0xa2, 0xff, 26 | 0xa0, 0x00, 0x9a, 0x4c, 0xfa, 0x00, 0x8d, 0xf9, 0xff, 0xad, 0xfb, 0xff, 27 | 0xd0, 0xfb, 0x4c, 0xf6, 0xf8, 0x8d, 0xf8, 0xff, 0x4c, 0x00, 0x00 28 | }; 29 | -------------------------------------------------------------------------------- /source/STM32firmware/PlusCart/Inc/stm32f4xx_it.h: -------------------------------------------------------------------------------- 1 | /* USER CODE BEGIN Header */ 2 | /** 3 | ****************************************************************************** 4 | * @file stm32f4xx_it.h 5 | * @brief This file contains the headers of the interrupt handlers. 6 | ****************************************************************************** 7 | * @attention 8 | * 9 | *

© Copyright (c) 2019 STMicroelectronics. 10 | * All rights reserved.

11 | * 12 | * This software component is licensed by ST under BSD 3-Clause license, 13 | * the "License"; You may not use this file except in compliance with the 14 | * License. You may obtain a copy of the License at: 15 | * opensource.org/licenses/BSD-3-Clause 16 | * 17 | ****************************************************************************** 18 | */ 19 | /* USER CODE END Header */ 20 | 21 | /* Define to prevent recursive inclusion -------------------------------------*/ 22 | #ifndef __STM32F4xx_IT_H 23 | #define __STM32F4xx_IT_H 24 | 25 | #ifdef __cplusplus 26 | extern "C" { 27 | #endif 28 | 29 | /* Private includes ----------------------------------------------------------*/ 30 | /* USER CODE BEGIN Includes */ 31 | 32 | /* USER CODE END Includes */ 33 | 34 | /* Exported types ------------------------------------------------------------*/ 35 | /* USER CODE BEGIN ET */ 36 | 37 | /* USER CODE END ET */ 38 | 39 | /* Exported constants --------------------------------------------------------*/ 40 | /* USER CODE BEGIN EC */ 41 | 42 | /* USER CODE END EC */ 43 | 44 | /* Exported macro ------------------------------------------------------------*/ 45 | /* USER CODE BEGIN EM */ 46 | 47 | /* USER CODE END EM */ 48 | 49 | /* Exported functions prototypes ---------------------------------------------*/ 50 | void NMI_Handler(void); 51 | void HardFault_Handler(void); 52 | void MemManage_Handler(void); 53 | void BusFault_Handler(void); 54 | void UsageFault_Handler(void); 55 | void SVC_Handler(void); 56 | void DebugMon_Handler(void); 57 | void PendSV_Handler(void); 58 | void SysTick_Handler(void); 59 | /* USER CODE BEGIN EFP */ 60 | 61 | /* USER CODE END EFP */ 62 | 63 | #ifdef __cplusplus 64 | } 65 | #endif 66 | 67 | #endif /* __STM32F4xx_IT_H */ 68 | 69 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 70 | -------------------------------------------------------------------------------- /source/ElfTests/vcsMock/vcsMock.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | void elf_main(uint32_t args); 4 | 5 | __attribute__((section(".vcsMock.const"))) 6 | const uint8_t ColorLookup[256] = { 0 }; 7 | 8 | __attribute__((section(".vcsMock.const"))) 9 | const uint8_t ReverseByte[256] = { 0 }; 10 | 11 | __attribute__((section(".vcsMock"))) 12 | void vcsWrite3(uint8_t ZP, uint8_t data) 13 | { 14 | elf_main(0); 15 | } 16 | 17 | __attribute__((section(".vcsMock"))) 18 | void vcsJmp3() 19 | { 20 | } 21 | 22 | __attribute__((section(".vcsMock"))) 23 | void vcsLda2(uint8_t data) 24 | { 25 | } 26 | 27 | __attribute__((section(".vcsMock"))) 28 | void vcsSta3(uint8_t ZP) 29 | { 30 | } 31 | 32 | __attribute__((section(".vcsMock"))) 33 | uint8_t vcsRead4(uint16_t address) 34 | { 35 | return 0; 36 | } 37 | 38 | __attribute__((section(".vcsMock"))) 39 | void vcsStartOverblank() 40 | { 41 | } 42 | 43 | __attribute__((section(".vcsMock"))) 44 | void vcsEndOverblank() 45 | { 46 | } 47 | 48 | __attribute__((section(".vcsMock"))) 49 | void vcsLdaForBusStuff2() 50 | { 51 | } 52 | 53 | __attribute__((section(".vcsMock"))) 54 | void vcsLdxForBusStuff2() 55 | { 56 | } 57 | 58 | __attribute__((section(".vcsMock"))) 59 | void vcsLdyForBusStuff2() 60 | { 61 | } 62 | 63 | __attribute__((section(".vcsMock"))) 64 | void vcsWrite5(uint8_t ZP, uint8_t data) 65 | { 66 | } 67 | 68 | __attribute__((section(".vcsMock"))) 69 | void vcsLdx2(uint8_t data) 70 | { 71 | } 72 | 73 | __attribute__((section(".vcsMock"))) 74 | void vcsLdy2(uint8_t data) 75 | { 76 | } 77 | 78 | __attribute__((section(".vcsMock"))) 79 | void vcsSta4(uint8_t ZP) 80 | { 81 | } 82 | 83 | __attribute__((section(".vcsMock"))) 84 | void vcsStx3(uint8_t ZP) 85 | { 86 | } 87 | 88 | __attribute__((section(".vcsMock"))) 89 | void vcsStx4(uint8_t ZP) 90 | { 91 | } 92 | 93 | __attribute__((section(".vcsMock"))) 94 | void vcsSty3(uint8_t ZP) 95 | { 96 | } 97 | 98 | __attribute__((section(".vcsMock"))) 99 | void vcsSty4(uint8_t ZP) 100 | { 101 | } 102 | 103 | __attribute__((section(".vcsMock"))) 104 | void vcsTxs2() 105 | { 106 | } 107 | 108 | __attribute__((section(".vcsMock"))) 109 | void vcsJsr6(uint16_t target) 110 | { 111 | } 112 | 113 | __attribute__((section(".vcsMock"))) 114 | void vcsNop2() 115 | { 116 | } 117 | 118 | __attribute__((section(".vcsMock"))) 119 | void vcsNop2n(uint16_t n) 120 | { 121 | } 122 | 123 | 124 | __attribute__((section(".vcsMock"))) 125 | void vcsCopyOverblankToRiotRam() 126 | { 127 | } -------------------------------------------------------------------------------- /source/ElfTests/debug/debug.c: -------------------------------------------------------------------------------- 1 | #include "vcsLib.h" 2 | 3 | const uint8_t HexDigits[16 * 8] = 4 | { 5 | 0x7c, 0x86, 0x8a, 0x92, 0xa2, 0xc2, 0x7c, 0x00, // 0 6 | 0x10, 0x30, 0x10, 0x10, 0x10, 0x10, 0x7c, 0x00, // 1 7 | 0x3c, 0x42, 0x44, 0x08, 0x10, 0x20, 0x7e, 0x00, // 2 8 | 0x3c, 0x42, 0x02, 0x1c, 0x02, 0x82, 0x7e, 0x00, // 3 9 | 0x82, 0x82, 0x82, 0x7e, 0x02, 0x02, 0x02, 0x00, // 4 10 | 0xfe, 0x80, 0x80, 0xfc, 0x02, 0x82, 0x7c, 0x00, // 5 11 | 0x08, 0x10, 0x20, 0x7c, 0x82, 0x82, 0x7c, 0x00, // 6 12 | 0xfe, 0x84, 0x08, 0x10, 0x20, 0x40, 0x80, 0x00, // 7 13 | 0x7c, 0x82, 0x82, 0x7c, 0x82, 0x82, 0x7c, 0x00, // 8 14 | 0x7c, 0x82, 0x82, 0x7c, 0x08, 0x10, 0x20, 0x00, // 9 15 | 0x10, 0x28, 0x44, 0xfe, 0x82, 0x82, 0x82, 0x00, // A 16 | 0xf8, 0x84, 0x84, 0xf8, 0x82, 0x82, 0xfc, 0x00, // B 17 | 0x3e, 0x40, 0x80, 0x80, 0x80, 0x40, 0x3e, 0x00, // C 18 | 0xfc, 0x84, 0x82, 0x82, 0x82, 0x84, 0xfc, 0x00, // D 19 | 0xfe, 0x80, 0x80, 0xf8, 0x80, 0x80, 0xfe, 0x00, // E 20 | 0xfe, 0x80, 0x80, 0xf8, 0x80, 0x80, 0x80, 0x00, // F 21 | }; 22 | 23 | int elf_main(uint32_t* args) 24 | { 25 | // Always reset PC first, cause it's going to be close to the end of the 6507 address space 26 | vcsJmp3(); 27 | 28 | // Init TIA and RIOT RAM 29 | vcsLda2(0); 30 | for (int i = 0; i < 256; i++) { 31 | vcsSta3((unsigned char)i); 32 | } 33 | 34 | while (1) 35 | { 36 | // 3 lines of VSYNC 37 | vcsLda2(2); 38 | vcsSta3(VSYNC); 39 | for (int i = 0; i < 3; i++) { 40 | vcsSta3(WSYNC); 41 | } 42 | vcsLda2(0); 43 | vcsSta3(VSYNC); 44 | // 37 lines of VBLANK 45 | for (int i = 0; i < 37; i++) { 46 | vcsSta3(WSYNC); 47 | } 48 | uint32_t displayValue = args[ARG_TYPE]; 49 | // 192 lines of COLUBK 50 | for (int k = 0; k < 4; k++) 51 | { 52 | const uint8_t* pf1a = &HexDigits[((displayValue >> (k * 8)) & 0xf) << 3]; 53 | const uint8_t* pf1b = &HexDigits[((displayValue >> ((k * 8)+4)) & 0xf) << 3]; 54 | 55 | for (int i = 0; i < 8; i++) 56 | { 57 | for (int j = 0; j < 6; j++) 58 | { 59 | vcsLda2(0); 60 | vcsSta3(VBLANK); 61 | vcsWrite5(COLUPF, 0xff); 62 | vcsWrite5(PF1, pf1a[i]); 63 | vcsJmp3(); 64 | vcsNop2n(11); 65 | vcsWrite5(PF1, pf1b[i]); 66 | vcsSta3(WSYNC); 67 | } 68 | } 69 | } 70 | 71 | vcsWrite5(VBLANK, 2); 72 | // 30 lines of Overscan 73 | for (int i = 0; i < 30; i++) { 74 | vcsSta3(WSYNC); 75 | uint8_t p0Button = vcsRead4(INPT4); 76 | if (0 == (p0Button & 0x80)) 77 | { 78 | vcsJmp3(); 79 | vcsNop2n(0xf00); 80 | return 0; 81 | } 82 | } 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /source/STM32firmware/PlusCart/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_flash_ramfunc.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32f4xx_hal_flash_ramfunc.h 4 | * @author MCD Application Team 5 | * @brief Header file of FLASH RAMFUNC driver. 6 | ****************************************************************************** 7 | * @attention 8 | * 9 | *

© Copyright (c) 2017 STMicroelectronics. 10 | * All rights reserved.

11 | * 12 | * This software component is licensed by ST under BSD 3-Clause license, 13 | * the "License"; You may not use this file except in compliance with the 14 | * License. You may obtain a copy of the License at: 15 | * opensource.org/licenses/BSD-3-Clause 16 | * 17 | ****************************************************************************** 18 | */ 19 | 20 | /* Define to prevent recursive inclusion -------------------------------------*/ 21 | #ifndef __STM32F4xx_FLASH_RAMFUNC_H 22 | #define __STM32F4xx_FLASH_RAMFUNC_H 23 | 24 | #ifdef __cplusplus 25 | extern "C" { 26 | #endif 27 | #if defined(STM32F410Tx) || defined(STM32F410Cx) || defined(STM32F410Rx) || defined(STM32F411xE) || defined(STM32F446xx) || defined(STM32F412Zx) ||\ 28 | defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F412Cx) 29 | 30 | /* Includes ------------------------------------------------------------------*/ 31 | #include "stm32f4xx_hal_def.h" 32 | 33 | /** @addtogroup STM32F4xx_HAL_Driver 34 | * @{ 35 | */ 36 | 37 | /** @addtogroup FLASH_RAMFUNC 38 | * @{ 39 | */ 40 | 41 | /* Exported types ------------------------------------------------------------*/ 42 | /* Exported macro ------------------------------------------------------------*/ 43 | /* Exported functions --------------------------------------------------------*/ 44 | /** @addtogroup FLASH_RAMFUNC_Exported_Functions 45 | * @{ 46 | */ 47 | 48 | /** @addtogroup FLASH_RAMFUNC_Exported_Functions_Group1 49 | * @{ 50 | */ 51 | __RAM_FUNC HAL_StatusTypeDef HAL_FLASHEx_StopFlashInterfaceClk(void); 52 | __RAM_FUNC HAL_StatusTypeDef HAL_FLASHEx_StartFlashInterfaceClk(void); 53 | __RAM_FUNC HAL_StatusTypeDef HAL_FLASHEx_EnableFlashSleepMode(void); 54 | __RAM_FUNC HAL_StatusTypeDef HAL_FLASHEx_DisableFlashSleepMode(void); 55 | /** 56 | * @} 57 | */ 58 | 59 | /** 60 | * @} 61 | */ 62 | 63 | /** 64 | * @} 65 | */ 66 | 67 | /** 68 | * @} 69 | */ 70 | 71 | #endif /* STM32F410xx || STM32F411xE || STM32F446xx || STM32F412Zx || STM32F412Vx || STM32F412Rx || STM32F412Cx */ 72 | #ifdef __cplusplus 73 | } 74 | #endif 75 | 76 | 77 | #endif /* __STM32F4xx_FLASH_RAMFUNC_H */ 78 | 79 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 80 | -------------------------------------------------------------------------------- /source/ElfTests/debug/vcsLib.h: -------------------------------------------------------------------------------- 1 | #ifndef VCSLIB_H 2 | #define VCSLIB_H 3 | 4 | #include 5 | 6 | #define MP_SYSTEM_TYPE 0 7 | #define MP_CLOCK_HZ 1 8 | #define MP_FEATURE_FLAGS 2 9 | #define MP_ELAPSED 3 // Do not use, debug only, will be replaced in future 10 | #define MP_THRESHOLD 4 // Do not use, debug only, will be replaced in future 11 | #define MP_COUNT 5 12 | 13 | #define ST_NTSC_2600 0 14 | #define ST_PAL_2600 1 15 | 16 | #define FF_MULTI_CART 1 // Indicates elf is loaded by multicart and should allow exiting (return from main() function) 17 | 18 | 19 | // Defines for VCS/2600 memory mapped registers 20 | #define VSYNC 0x00 21 | #define VBLANK 0x01 22 | #define WSYNC 0x02 23 | #define RSYNC 0x03 24 | #define NUSIZ0 0x04 25 | #define NUSIZ1 0x05 26 | #define COLUP0 0x06 27 | #define COLUP1 0x07 28 | #define COLUPF 0x08 29 | #define COLUBK 0x09 30 | #define CTRLPF 0x0A 31 | #define REFP0 0x0B 32 | #define REFP1 0x0C 33 | #define PF0 0x0D 34 | #define PF1 0x0E 35 | #define PF2 0x0F 36 | #define RESP0 0x10 37 | #define POSH2 0x11 38 | #define RESPONE 0x11 39 | #define RESM0 0x12 40 | #define RESM1 0x13 41 | #define RESBL 0x14 42 | #define AUDC0 0x15 43 | #define AUDC1 0x16 44 | #define AUDF0 0x17 45 | #define AUDF1 0x18 46 | #define AUDV0 0x19 47 | #define AUDV1 0x1A 48 | #define GRP0 0x1B 49 | #define GRP1 0x1C 50 | #define ENAM0 0x1D 51 | #define ENAM1 0x1E 52 | #define ENABL 0x1F 53 | #define HMP0 0x20 54 | #define HMP1 0x21 55 | #define HMM0 0x22 56 | #define HMM1 0x23 57 | #define HMBL 0x24 58 | #define VDELP0 0x25 59 | #define VDELP1 0x26 60 | #define VDELBL 0x27 61 | #define RESMP0 0x28 62 | #define RESMP1 0x29 63 | #define HMOVE 0x2A 64 | #define HMCLR 0x2B 65 | #define CXCLR 0x2C 66 | 67 | #define CXP0FB 0x02 68 | 69 | 70 | #define INPT4 0x000c 71 | #ifndef SWCHA 72 | #define SWCHA 0x0280 73 | #endif 74 | 75 | 76 | // For firmware use only 77 | void vcsLibInit(int initBusStuffing); 78 | 79 | // For firmware or game use 80 | void vcsJmp3(); 81 | void vcsLda2(uint8_t data); 82 | void vcsSta3(uint8_t zeroPage); 83 | uint8_t vcsRead4(uint16_t address); 84 | void vcsCopyOverblankToRiotRam(); 85 | void vcsStartOverblank(); 86 | void vcsEndOverblank(); 87 | void vcsLdaForBusStuff2(); 88 | void vcsLdxForBusStuff2(); 89 | void vcsLdyForBusStuff2(); 90 | void vcsWrite3(uint8_t ZP, uint8_t data); 91 | void vcsWrite5(uint8_t ZP, uint8_t data); 92 | void vcsLdx2(uint8_t data); 93 | void vcsLdy2(uint8_t data); 94 | void vcsSta4(uint8_t ZP); 95 | void vcsStx3(uint8_t ZP); 96 | void vcsStx4(uint8_t ZP); 97 | void vcsSty3(uint8_t ZP); 98 | void vcsSty4(uint8_t ZP); 99 | void vcsTxs2(); 100 | void vcsJsr6(uint16_t target); 101 | void vcsNop2(); 102 | void vcsNop2n(uint16_t n); 103 | 104 | #endif // VCSLIB_H 105 | -------------------------------------------------------------------------------- /source/ElfTests/raycaster/vcsLib.h: -------------------------------------------------------------------------------- 1 | #ifndef VCSLIB_H 2 | #define VCSLIB_H 3 | 4 | #include 5 | 6 | #define MP_SYSTEM_TYPE 0 7 | #define MP_CLOCK_HZ 1 8 | #define MP_FEATURE_FLAGS 2 9 | #define MP_ELAPSED 3 // Do not use, debug only, will be replaced in future 10 | #define MP_THRESHOLD 4 // Do not use, debug only, will be replaced in future 11 | #define MP_COUNT 5 12 | 13 | #define ST_NTSC_2600 0 14 | #define ST_PAL_2600 1 15 | 16 | #define FF_MULTI_CART 1 // Indicates elf is loaded by multicart and should allow exiting (return from main() function) 17 | 18 | 19 | // Defines for VCS/2600 memory mapped registers 20 | #define VSYNC 0x00 21 | #define VBLANK 0x01 22 | #define WSYNC 0x02 23 | #define RSYNC 0x03 24 | #define NUSIZ0 0x04 25 | #define NUSIZ1 0x05 26 | #define COLUP0 0x06 27 | #define COLUP1 0x07 28 | #define COLUPF 0x08 29 | #define COLUBK 0x09 30 | #define CTRLPF 0x0A 31 | #define REFP0 0x0B 32 | #define REFP1 0x0C 33 | #define PF0 0x0D 34 | #define PF1 0x0E 35 | #define PF2 0x0F 36 | #define RESP0 0x10 37 | #define POSH2 0x11 38 | #define RESPONE 0x11 39 | #define RESM0 0x12 40 | #define RESM1 0x13 41 | #define RESBL 0x14 42 | #define AUDC0 0x15 43 | #define AUDC1 0x16 44 | #define AUDF0 0x17 45 | #define AUDF1 0x18 46 | #define AUDV0 0x19 47 | #define AUDV1 0x1A 48 | #define GRP0 0x1B 49 | #define GRP1 0x1C 50 | #define ENAM0 0x1D 51 | #define ENAM1 0x1E 52 | #define ENABL 0x1F 53 | #define HMP0 0x20 54 | #define HMP1 0x21 55 | #define HMM0 0x22 56 | #define HMM1 0x23 57 | #define HMBL 0x24 58 | #define VDELP0 0x25 59 | #define VDELP1 0x26 60 | #define VDELBL 0x27 61 | #define RESMP0 0x28 62 | #define RESMP1 0x29 63 | #define HMOVE 0x2A 64 | #define HMCLR 0x2B 65 | #define CXCLR 0x2C 66 | 67 | #define CXP0FB 0x02 68 | 69 | 70 | #define INPT4 0x000c 71 | #ifndef SWCHA 72 | #define SWCHA 0x0280 73 | #endif 74 | 75 | 76 | // For firmware use only 77 | void vcsLibInit(int initBusStuffing); 78 | 79 | // For firmware or game use 80 | void vcsJmp3(); 81 | void vcsLda2(uint8_t data); 82 | void vcsSta3(uint8_t zeroPage); 83 | uint8_t vcsRead4(uint16_t address); 84 | void vcsCopyOverblankToRiotRam(); 85 | void vcsStartOverblank(); 86 | void vcsEndOverblank(); 87 | void vcsLdaForBusStuff2(); 88 | void vcsLdxForBusStuff2(); 89 | void vcsLdyForBusStuff2(); 90 | void vcsWrite3(uint8_t ZP, uint8_t data); 91 | void vcsWrite5(uint8_t ZP, uint8_t data); 92 | void vcsLdx2(uint8_t data); 93 | void vcsLdy2(uint8_t data); 94 | void vcsSta4(uint8_t ZP); 95 | void vcsStx3(uint8_t ZP); 96 | void vcsStx4(uint8_t ZP); 97 | void vcsSty3(uint8_t ZP); 98 | void vcsSty4(uint8_t ZP); 99 | void vcsTxs2(); 100 | void vcsJsr6(uint16_t target); 101 | void vcsNop2(); 102 | void vcsNop2n(uint16_t n); 103 | 104 | #endif // VCSLIB_H 105 | -------------------------------------------------------------------------------- /source/ElfTests/region/vcsLib.h: -------------------------------------------------------------------------------- 1 | #ifndef VCSLIB_H 2 | #define VCSLIB_H 3 | 4 | #include 5 | 6 | #define MP_SYSTEM_TYPE 0 7 | #define MP_CLOCK_HZ 1 8 | #define MP_FEATURE_FLAGS 2 9 | #define MP_ELAPSED 3 // Do not use, debug only, will be replaced in future 10 | #define MP_THRESHOLD 4 // Do not use, debug only, will be replaced in future 11 | #define MP_COUNT 5 12 | 13 | #define ST_NTSC_2600 0 14 | #define ST_PAL_2600 1 15 | 16 | #define FF_MULTI_CART 1 // Indicates elf is loaded by multicart and should allow exiting (return from main() function) 17 | 18 | 19 | // Defines for VCS/2600 memory mapped registers 20 | #define VSYNC 0x00 21 | #define VBLANK 0x01 22 | #define WSYNC 0x02 23 | #define RSYNC 0x03 24 | #define NUSIZ0 0x04 25 | #define NUSIZ1 0x05 26 | #define COLUP0 0x06 27 | #define COLUP1 0x07 28 | #define COLUPF 0x08 29 | #define COLUBK 0x09 30 | #define CTRLPF 0x0A 31 | #define REFP0 0x0B 32 | #define REFP1 0x0C 33 | #define PF0 0x0D 34 | #define PF1 0x0E 35 | #define PF2 0x0F 36 | #define RESP0 0x10 37 | #define POSH2 0x11 38 | #define RESPONE 0x11 39 | #define RESM0 0x12 40 | #define RESM1 0x13 41 | #define RESBL 0x14 42 | #define AUDC0 0x15 43 | #define AUDC1 0x16 44 | #define AUDF0 0x17 45 | #define AUDF1 0x18 46 | #define AUDV0 0x19 47 | #define AUDV1 0x1A 48 | #define GRP0 0x1B 49 | #define GRP1 0x1C 50 | #define ENAM0 0x1D 51 | #define ENAM1 0x1E 52 | #define ENABL 0x1F 53 | #define HMP0 0x20 54 | #define HMP1 0x21 55 | #define HMM0 0x22 56 | #define HMM1 0x23 57 | #define HMBL 0x24 58 | #define VDELP0 0x25 59 | #define VDELP1 0x26 60 | #define VDELBL 0x27 61 | #define RESMP0 0x28 62 | #define RESMP1 0x29 63 | #define HMOVE 0x2A 64 | #define HMCLR 0x2B 65 | #define CXCLR 0x2C 66 | 67 | #define CXP0FB 0x02 68 | 69 | 70 | #define INPT4 0x000c 71 | #ifndef SWCHA 72 | #define SWCHA 0x0280 73 | #endif 74 | 75 | 76 | // For firmware use only 77 | void vcsLibInit(int initBusStuffing); 78 | 79 | // For firmware or game use 80 | void vcsJmp3(); 81 | void vcsLda2(uint8_t data); 82 | void vcsSta3(uint8_t zeroPage); 83 | uint8_t vcsRead4(uint16_t address); 84 | void vcsCopyOverblankToRiotRam(); 85 | void vcsStartOverblank(); 86 | void vcsEndOverblank(); 87 | void vcsLdaForBusStuff2(); 88 | void vcsLdxForBusStuff2(); 89 | void vcsLdyForBusStuff2(); 90 | void vcsWrite3(uint8_t ZP, uint8_t data); 91 | void vcsWrite5(uint8_t ZP, uint8_t data); 92 | void vcsLdx2(uint8_t data); 93 | void vcsLdy2(uint8_t data); 94 | void vcsSta4(uint8_t ZP); 95 | void vcsStx3(uint8_t ZP); 96 | void vcsStx4(uint8_t ZP); 97 | void vcsSty3(uint8_t ZP); 98 | void vcsSty4(uint8_t ZP); 99 | void vcsTxs2(); 100 | void vcsJsr6(uint16_t target); 101 | void vcsNop2(); 102 | void vcsNop2n(uint16_t n); 103 | 104 | #endif // VCSLIB_H 105 | -------------------------------------------------------------------------------- /source/ElfTests/rom-elf/vcsLib.h: -------------------------------------------------------------------------------- 1 | #ifndef VCSLIB_H 2 | #define VCSLIB_H 3 | 4 | #include 5 | 6 | #define MP_SYSTEM_TYPE 0 7 | #define MP_CLOCK_HZ 1 8 | #define MP_FEATURE_FLAGS 2 9 | #define MP_ELAPSED 3 // Do not use, debug only, will be replaced in future 10 | #define MP_THRESHOLD 4 // Do not use, debug only, will be replaced in future 11 | #define MP_COUNT 5 12 | 13 | #define ST_NTSC_2600 0 14 | #define ST_PAL_2600 1 15 | 16 | #define FF_MULTI_CART 1 // Indicates elf is loaded by multicart and should allow exiting (return from main() function) 17 | 18 | 19 | // Defines for VCS/2600 memory mapped registers 20 | #define VSYNC 0x00 21 | #define VBLANK 0x01 22 | #define WSYNC 0x02 23 | #define RSYNC 0x03 24 | #define NUSIZ0 0x04 25 | #define NUSIZ1 0x05 26 | #define COLUP0 0x06 27 | #define COLUP1 0x07 28 | #define COLUPF 0x08 29 | #define COLUBK 0x09 30 | #define CTRLPF 0x0A 31 | #define REFP0 0x0B 32 | #define REFP1 0x0C 33 | #define PF0 0x0D 34 | #define PF1 0x0E 35 | #define PF2 0x0F 36 | #define RESP0 0x10 37 | #define POSH2 0x11 38 | #define RESPONE 0x11 39 | #define RESM0 0x12 40 | #define RESM1 0x13 41 | #define RESBL 0x14 42 | #define AUDC0 0x15 43 | #define AUDC1 0x16 44 | #define AUDF0 0x17 45 | #define AUDF1 0x18 46 | #define AUDV0 0x19 47 | #define AUDV1 0x1A 48 | #define GRP0 0x1B 49 | #define GRP1 0x1C 50 | #define ENAM0 0x1D 51 | #define ENAM1 0x1E 52 | #define ENABL 0x1F 53 | #define HMP0 0x20 54 | #define HMP1 0x21 55 | #define HMM0 0x22 56 | #define HMM1 0x23 57 | #define HMBL 0x24 58 | #define VDELP0 0x25 59 | #define VDELP1 0x26 60 | #define VDELBL 0x27 61 | #define RESMP0 0x28 62 | #define RESMP1 0x29 63 | #define HMOVE 0x2A 64 | #define HMCLR 0x2B 65 | #define CXCLR 0x2C 66 | 67 | #define CXP0FB 0x02 68 | 69 | 70 | #define INPT4 0x000c 71 | #ifndef SWCHA 72 | #define SWCHA 0x0280 73 | #endif 74 | 75 | 76 | // For firmware use only 77 | void vcsLibInit(int initBusStuffing); 78 | 79 | // For firmware or game use 80 | void vcsJmp3(); 81 | void vcsLda2(uint8_t data); 82 | void vcsSta3(uint8_t zeroPage); 83 | uint8_t vcsRead4(uint16_t address); 84 | void vcsCopyOverblankToRiotRam(); 85 | void vcsStartOverblank(); 86 | void vcsEndOverblank(); 87 | void vcsLdaForBusStuff2(); 88 | void vcsLdxForBusStuff2(); 89 | void vcsLdyForBusStuff2(); 90 | void vcsWrite3(uint8_t ZP, uint8_t data); 91 | void vcsWrite5(uint8_t ZP, uint8_t data); 92 | void vcsLdx2(uint8_t data); 93 | void vcsLdy2(uint8_t data); 94 | void vcsSta4(uint8_t ZP); 95 | void vcsStx3(uint8_t ZP); 96 | void vcsStx4(uint8_t ZP); 97 | void vcsSty3(uint8_t ZP); 98 | void vcsSty4(uint8_t ZP); 99 | void vcsTxs2(); 100 | void vcsJsr6(uint16_t target); 101 | void vcsNop2(); 102 | void vcsNop2n(uint16_t n); 103 | 104 | #endif // VCSLIB_H 105 | -------------------------------------------------------------------------------- /source/STM32firmware/PlusCart/Middlewares/Third_Party/FatFs/src/diskio.h: -------------------------------------------------------------------------------- 1 | /*-----------------------------------------------------------------------/ 2 | / Low level disk interface modlue include file (C)ChaN, 2014 / 3 | /-----------------------------------------------------------------------*/ 4 | 5 | #ifndef _DISKIO_DEFINED 6 | #define _DISKIO_DEFINED 7 | 8 | #ifdef __cplusplus 9 | extern "C" { 10 | #endif 11 | 12 | #define _USE_WRITE 1 /* 1: Enable disk_write function */ 13 | #define _USE_IOCTL 1 /* 1: Enable disk_ioctl function */ 14 | 15 | #include "integer.h" 16 | 17 | 18 | /* Status of Disk Functions */ 19 | typedef BYTE DSTATUS; 20 | 21 | /* Results of Disk Functions */ 22 | typedef enum { 23 | RES_OK = 0, /* 0: Successful */ 24 | RES_ERROR, /* 1: R/W Error */ 25 | RES_WRPRT, /* 2: Write Protected */ 26 | RES_NOTRDY, /* 3: Not Ready */ 27 | RES_PARERR /* 4: Invalid Parameter */ 28 | } DRESULT; 29 | 30 | 31 | /*---------------------------------------*/ 32 | /* Prototypes for disk control functions */ 33 | 34 | 35 | DSTATUS disk_initialize (BYTE pdrv); 36 | DSTATUS disk_status (BYTE pdrv); 37 | DRESULT disk_read (BYTE pdrv, BYTE* buff, DWORD sector, UINT count); 38 | DRESULT disk_write (BYTE pdrv, const BYTE* buff, DWORD sector, UINT count); 39 | DRESULT disk_ioctl (BYTE pdrv, BYTE cmd, void* buff); 40 | DWORD get_fattime (void); 41 | 42 | /* Disk Status Bits (DSTATUS) */ 43 | 44 | #define STA_NOINIT 0x01 /* Drive not initialized */ 45 | #define STA_NODISK 0x02 /* No medium in the drive */ 46 | #define STA_PROTECT 0x04 /* Write protected */ 47 | 48 | 49 | /* Command code for disk_ioctrl fucntion */ 50 | 51 | /* Generic command (Used by FatFs) */ 52 | #define CTRL_SYNC 0 /* Complete pending write process (needed at _FS_READONLY == 0) */ 53 | #define GET_SECTOR_COUNT 1 /* Get media size (needed at _USE_MKFS == 1) */ 54 | #define GET_SECTOR_SIZE 2 /* Get sector size (needed at _MAX_SS != _MIN_SS) */ 55 | #define GET_BLOCK_SIZE 3 /* Get erase block size (needed at _USE_MKFS == 1) */ 56 | #define CTRL_TRIM 4 /* Inform device that the data on the block of sectors is no longer used (needed at _USE_TRIM == 1) */ 57 | 58 | /* Generic command (Not used by FatFs) */ 59 | #define CTRL_POWER 5 /* Get/Set power status */ 60 | #define CTRL_LOCK 6 /* Lock/Unlock media removal */ 61 | #define CTRL_EJECT 7 /* Eject media */ 62 | #define CTRL_FORMAT 8 /* Create physical format on the media */ 63 | 64 | /* MMC/SDC specific ioctl command */ 65 | #define MMC_GET_TYPE 10 /* Get card type */ 66 | #define MMC_GET_CSD 11 /* Get CSD */ 67 | #define MMC_GET_CID 12 /* Get CID */ 68 | #define MMC_GET_OCR 13 /* Get OCR */ 69 | #define MMC_GET_SDSTAT 14 /* Get SD status */ 70 | 71 | /* ATA/CF specific ioctl command */ 72 | #define ATA_GET_REV 20 /* Get F/W revision */ 73 | #define ATA_GET_MODEL 21 /* Get model name */ 74 | #define ATA_GET_SN 22 /* Get serial number */ 75 | 76 | #ifdef __cplusplus 77 | } 78 | #endif 79 | 80 | #endif 81 | -------------------------------------------------------------------------------- /source/STM32firmware/PlusCart/Drivers/CMSIS/Include/tz_context.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * @file tz_context.h 3 | * @brief Context Management for Armv8-M TrustZone 4 | * @version V1.0.1 5 | * @date 10. January 2018 6 | ******************************************************************************/ 7 | /* 8 | * Copyright (c) 2017-2018 Arm Limited. All rights reserved. 9 | * 10 | * SPDX-License-Identifier: Apache-2.0 11 | * 12 | * Licensed under the Apache License, Version 2.0 (the License); you may 13 | * not use this file except in compliance with the License. 14 | * You may obtain a copy of the License at 15 | * 16 | * www.apache.org/licenses/LICENSE-2.0 17 | * 18 | * Unless required by applicable law or agreed to in writing, software 19 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 20 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 21 | * See the License for the specific language governing permissions and 22 | * limitations under the License. 23 | */ 24 | 25 | #if defined ( __ICCARM__ ) 26 | #pragma system_include /* treat file as system include file for MISRA check */ 27 | #elif defined (__clang__) 28 | #pragma clang system_header /* treat file as system include file */ 29 | #endif 30 | 31 | #ifndef TZ_CONTEXT_H 32 | #define TZ_CONTEXT_H 33 | 34 | #include 35 | 36 | #ifndef TZ_MODULEID_T 37 | #define TZ_MODULEID_T 38 | /// \details Data type that identifies secure software modules called by a process. 39 | typedef uint32_t TZ_ModuleId_t; 40 | #endif 41 | 42 | /// \details TZ Memory ID identifies an allocated memory slot. 43 | typedef uint32_t TZ_MemoryId_t; 44 | 45 | /// Initialize secure context memory system 46 | /// \return execution status (1: success, 0: error) 47 | uint32_t TZ_InitContextSystem_S (void); 48 | 49 | /// Allocate context memory for calling secure software modules in TrustZone 50 | /// \param[in] module identifies software modules called from non-secure mode 51 | /// \return value != 0 id TrustZone memory slot identifier 52 | /// \return value 0 no memory available or internal error 53 | TZ_MemoryId_t TZ_AllocModuleContext_S (TZ_ModuleId_t module); 54 | 55 | /// Free context memory that was previously allocated with \ref TZ_AllocModuleContext_S 56 | /// \param[in] id TrustZone memory slot identifier 57 | /// \return execution status (1: success, 0: error) 58 | uint32_t TZ_FreeModuleContext_S (TZ_MemoryId_t id); 59 | 60 | /// Load secure context (called on RTOS thread context switch) 61 | /// \param[in] id TrustZone memory slot identifier 62 | /// \return execution status (1: success, 0: error) 63 | uint32_t TZ_LoadContext_S (TZ_MemoryId_t id); 64 | 65 | /// Store secure context (called on RTOS thread context switch) 66 | /// \param[in] id TrustZone memory slot identifier 67 | /// \return execution status (1: success, 0: error) 68 | uint32_t TZ_StoreContext_S (TZ_MemoryId_t id); 69 | 70 | #endif // TZ_CONTEXT_H 71 | -------------------------------------------------------------------------------- /source/STM32firmware/PlusCart/Middlewares/Third_Party/FatFs/src/ff_gen_drv.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file ff_gen_drv.h 4 | * @author MCD Application Team 5 | * @brief Header for ff_gen_drv.c module. 6 | ***************************************************************************** 7 | * @attention 8 | * 9 | * Copyright (c) 2017 STMicroelectronics. All rights reserved. 10 | * 11 | * This software component is licensed by ST under BSD 3-Clause license, 12 | * the "License"; You may not use this file except in compliance with the 13 | * License. You may obtain a copy of the License at: 14 | * opensource.org/licenses/BSD-3-Clause 15 | * 16 | ****************************************************************************** 17 | **/ 18 | 19 | /* Define to prevent recursive inclusion -------------------------------------*/ 20 | #ifndef __FF_GEN_DRV_H 21 | #define __FF_GEN_DRV_H 22 | 23 | #ifdef __cplusplus 24 | extern "C" { 25 | #endif 26 | 27 | /* Includes ------------------------------------------------------------------*/ 28 | #include "diskio.h" 29 | #include "ff.h" 30 | #include "stdint.h" 31 | 32 | 33 | /* Exported types ------------------------------------------------------------*/ 34 | 35 | /** 36 | * @brief Disk IO Driver structure definition 37 | */ 38 | typedef struct 39 | { 40 | DSTATUS (*disk_initialize) (BYTE); /*!< Initialize Disk Drive */ 41 | DSTATUS (*disk_status) (BYTE); /*!< Get Disk Status */ 42 | DRESULT (*disk_read) (BYTE, BYTE*, DWORD, UINT); /*!< Read Sector(s) */ 43 | #if _USE_WRITE == 1 44 | DRESULT (*disk_write) (BYTE, const BYTE*, DWORD, UINT); /*!< Write Sector(s) when _USE_WRITE = 0 */ 45 | #endif /* _USE_WRITE == 1 */ 46 | #if _USE_IOCTL == 1 47 | DRESULT (*disk_ioctl) (BYTE, BYTE, void*); /*!< I/O control operation when _USE_IOCTL = 1 */ 48 | #endif /* _USE_IOCTL == 1 */ 49 | 50 | }Diskio_drvTypeDef; 51 | 52 | /** 53 | * @brief Global Disk IO Drivers structure definition 54 | */ 55 | typedef struct 56 | { 57 | uint8_t is_initialized[_VOLUMES]; 58 | const Diskio_drvTypeDef *drv[_VOLUMES]; 59 | uint8_t lun[_VOLUMES]; 60 | volatile uint8_t nbr; 61 | 62 | }Disk_drvTypeDef; 63 | 64 | /* Exported constants --------------------------------------------------------*/ 65 | /* Exported macro ------------------------------------------------------------*/ 66 | /* Exported functions ------------------------------------------------------- */ 67 | uint8_t FATFS_LinkDriver(const Diskio_drvTypeDef *drv, char *path); 68 | uint8_t FATFS_UnLinkDriver(char *path); 69 | uint8_t FATFS_LinkDriverEx(const Diskio_drvTypeDef *drv, char *path, BYTE lun); 70 | uint8_t FATFS_UnLinkDriverEx(char *path, BYTE lun); 71 | uint8_t FATFS_GetAttachedDriversNbr(void); 72 | 73 | #ifdef __cplusplus 74 | } 75 | #endif 76 | 77 | #endif /* __FF_GEN_DRV_H */ 78 | 79 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 80 | 81 | -------------------------------------------------------------------------------- /source/STM32firmware/PlusCart/Src/sysmem.c: -------------------------------------------------------------------------------- 1 | /** 2 | ***************************************************************************** 3 | ** 4 | ** File : sysmem.c 5 | ** 6 | ** Author : Auto-generated by STM32CubeIDE 7 | ** 8 | ** Abstract : STM32CubeIDE Minimal System Memory calls file 9 | ** 10 | ** For more information about which c-functions 11 | ** need which of these lowlevel functions 12 | ** please consult the Newlib libc-manual 13 | ** 14 | ** Environment : STM32CubeIDE MCU 15 | ** 16 | ** Distribution: The file is distributed as is, without any warranty 17 | ** of any kind. 18 | ** 19 | ***************************************************************************** 20 | ** 21 | **

© COPYRIGHT(c) 2018 STMicroelectronics

22 | ** 23 | ** Redistribution and use in source and binary forms, with or without modification, 24 | ** are permitted provided that the following conditions are met: 25 | ** 1. Redistributions of source code must retain the above copyright notice, 26 | ** this list of conditions and the following disclaimer. 27 | ** 2. Redistributions in binary form must reproduce the above copyright notice, 28 | ** this list of conditions and the following disclaimer in the documentation 29 | ** and/or other materials provided with the distribution. 30 | ** 3. Neither the name of STMicroelectronics nor the names of its contributors 31 | ** may be used to endorse or promote products derived from this software 32 | ** without specific prior written permission. 33 | ** 34 | ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 35 | ** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 36 | ** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 37 | ** DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 38 | ** FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 39 | ** DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 40 | ** SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 41 | ** CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 42 | ** OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 43 | ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 44 | ** 45 | ** 46 | ***************************************************************************** 47 | */ 48 | 49 | /* Includes */ 50 | #include 51 | #include 52 | #include 53 | 54 | /* Variables */ 55 | extern int errno; 56 | register char * stack_ptr asm("sp"); 57 | 58 | /* Functions */ 59 | 60 | /** 61 | _sbrk 62 | Increase program data space. Malloc and related functions depend on this 63 | **/ 64 | caddr_t _sbrk(int incr) 65 | { 66 | extern char end asm("end"); 67 | static char *heap_end; 68 | char *prev_heap_end; 69 | 70 | if (heap_end == 0) 71 | heap_end = &end; 72 | 73 | prev_heap_end = heap_end; 74 | if (heap_end + incr > stack_ptr) 75 | { 76 | errno = ENOMEM; 77 | return (caddr_t) -1; 78 | } 79 | 80 | heap_end += incr; 81 | 82 | return (caddr_t) prev_heap_end; 83 | } 84 | 85 | -------------------------------------------------------------------------------- /source/STM32firmware/PlusCart/Inc/md5.h: -------------------------------------------------------------------------------- 1 | /** 2 | * \file md5.h 3 | * 4 | * Based on XySSL: Copyright (C) 2006-2008 Christophe Devine 5 | * 6 | * Copyright (C) 2009 Paul Bakker 7 | * 8 | * All rights reserved. 9 | * 10 | * Redistribution and use in source and binary forms, with or without 11 | * modification, are permitted provided that the following conditions 12 | * are met: 13 | * 14 | * * Redistributions of source code must retain the above copyright 15 | * notice, this list of conditions and the following disclaimer. 16 | * * Redistributions in binary form must reproduce the above copyright 17 | * notice, this list of conditions and the following disclaimer in the 18 | * documentation and/or other materials provided with the distribution. 19 | * * Neither the names of PolarSSL or XySSL nor the names of its contributors 20 | * may be used to endorse or promote products derived from this software 21 | * without specific prior written permission. 22 | * 23 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 24 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 25 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 26 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 27 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 28 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 29 | * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 30 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 31 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 32 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 33 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 34 | */ 35 | 36 | 37 | #ifndef LWIP_INCLUDED_POLARSSL_MD5_H 38 | #define LWIP_INCLUDED_POLARSSL_MD5_H 39 | 40 | /** 41 | * \brief MD5 context structure 42 | */ 43 | typedef struct 44 | { 45 | unsigned long total[2]; /*!< number of bytes processed */ 46 | unsigned long state[4]; /*!< intermediate digest state */ 47 | unsigned char buffer[64]; /*!< data block being processed */ 48 | } 49 | md5_context; 50 | 51 | #ifdef __cplusplus 52 | extern "C" { 53 | #endif 54 | 55 | /** 56 | * \brief MD5 context setup 57 | * 58 | * \param ctx context to be initialized 59 | */ 60 | void md5_starts( md5_context *ctx ); 61 | 62 | /** 63 | * \brief MD5 process buffer 64 | * 65 | * \param ctx MD5 context 66 | * \param input buffer holding the data 67 | * \param ilen length of the input data 68 | */ 69 | void md5_update( md5_context *ctx, const unsigned char *input, int ilen ); 70 | 71 | /** 72 | * \brief MD5 final digest 73 | * 74 | * \param ctx MD5 context 75 | * \param output MD5 checksum result 76 | */ 77 | void md5_finish( md5_context *ctx, unsigned char output[16] ); 78 | 79 | /** 80 | * \brief Output = MD5( input buffer ) 81 | * 82 | * \param input buffer holding the data 83 | * \param ilen length of the input data 84 | * \param output MD5 checksum result 85 | */ 86 | void md5( unsigned char *input, int ilen, unsigned char output[16] ); 87 | 88 | #ifdef __cplusplus 89 | } 90 | #endif 91 | 92 | #endif /* LWIP_INCLUDED_POLARSSL_MD5_H */ 93 | 94 | -------------------------------------------------------------------------------- /source/STM32firmware/PlusCart/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_dma_ex.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32f4xx_hal_dma_ex.h 4 | * @author MCD Application Team 5 | * @brief Header file of DMA HAL extension module. 6 | ****************************************************************************** 7 | * @attention 8 | * 9 | *

© Copyright (c) 2017 STMicroelectronics. 10 | * All rights reserved.

11 | * 12 | * This software component is licensed by ST under BSD 3-Clause license, 13 | * the "License"; You may not use this file except in compliance with the 14 | * License. You may obtain a copy of the License at: 15 | * opensource.org/licenses/BSD-3-Clause 16 | * 17 | ****************************************************************************** 18 | */ 19 | 20 | /* Define to prevent recursive inclusion -------------------------------------*/ 21 | #ifndef __STM32F4xx_HAL_DMA_EX_H 22 | #define __STM32F4xx_HAL_DMA_EX_H 23 | 24 | #ifdef __cplusplus 25 | extern "C" { 26 | #endif 27 | 28 | /* Includes ------------------------------------------------------------------*/ 29 | #include "stm32f4xx_hal_def.h" 30 | 31 | /** @addtogroup STM32F4xx_HAL_Driver 32 | * @{ 33 | */ 34 | 35 | /** @addtogroup DMAEx 36 | * @{ 37 | */ 38 | 39 | /* Exported types ------------------------------------------------------------*/ 40 | /** @defgroup DMAEx_Exported_Types DMAEx Exported Types 41 | * @brief DMAEx Exported types 42 | * @{ 43 | */ 44 | 45 | /** 46 | * @brief HAL DMA Memory definition 47 | */ 48 | typedef enum 49 | { 50 | MEMORY0 = 0x00U, /*!< Memory 0 */ 51 | MEMORY1 = 0x01U /*!< Memory 1 */ 52 | }HAL_DMA_MemoryTypeDef; 53 | 54 | /** 55 | * @} 56 | */ 57 | 58 | /* Exported functions --------------------------------------------------------*/ 59 | /** @defgroup DMAEx_Exported_Functions DMAEx Exported Functions 60 | * @brief DMAEx Exported functions 61 | * @{ 62 | */ 63 | 64 | /** @defgroup DMAEx_Exported_Functions_Group1 Extended features functions 65 | * @brief Extended features functions 66 | * @{ 67 | */ 68 | 69 | /* IO operation functions *******************************************************/ 70 | HAL_StatusTypeDef HAL_DMAEx_MultiBufferStart(DMA_HandleTypeDef *hdma, uint32_t SrcAddress, uint32_t DstAddress, uint32_t SecondMemAddress, uint32_t DataLength); 71 | HAL_StatusTypeDef HAL_DMAEx_MultiBufferStart_IT(DMA_HandleTypeDef *hdma, uint32_t SrcAddress, uint32_t DstAddress, uint32_t SecondMemAddress, uint32_t DataLength); 72 | HAL_StatusTypeDef HAL_DMAEx_ChangeMemory(DMA_HandleTypeDef *hdma, uint32_t Address, HAL_DMA_MemoryTypeDef memory); 73 | 74 | /** 75 | * @} 76 | */ 77 | /** 78 | * @} 79 | */ 80 | 81 | /* Private functions ---------------------------------------------------------*/ 82 | /** @defgroup DMAEx_Private_Functions DMAEx Private Functions 83 | * @brief DMAEx Private functions 84 | * @{ 85 | */ 86 | /** 87 | * @} 88 | */ 89 | 90 | /** 91 | * @} 92 | */ 93 | 94 | /** 95 | * @} 96 | */ 97 | 98 | #ifdef __cplusplus 99 | } 100 | #endif 101 | 102 | #endif /*__STM32F4xx_HAL_DMA_EX_H*/ 103 | 104 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 105 | -------------------------------------------------------------------------------- /source/STM32firmware/PlusCart/Inc/elfLib.h: -------------------------------------------------------------------------------- 1 | #ifndef ELFLIB_H 2 | #define ELFLIB_H 3 | 4 | #include 5 | 6 | #define SHT_PROGBITS 1 7 | #define SHT_SYMTAB 2 8 | #define SHT_STRTAB 3 9 | #define SHT_RELA 4 10 | #define SHT_HASH 5 11 | #define SHT_DYNAMIC 6 12 | #define SHT_NOTE 7 13 | #define SHT_NOBITS 8 14 | #define SHT_REL 9 15 | #define SHT_INIT_ARRAY 0xe 16 | #define SHT_PREINIT_ARRAY 0x10 17 | 18 | #define SHF_WRITE 0x001 19 | #define SHF_ALLOC 0x002 20 | #define SHF_EXECINSTR 0x004 21 | #define SHF_MERGE 0x010 22 | #define SHF_STRINGS 0x020 23 | #define SHF_INFO_LINK 0x040 24 | #define SHF_LINK_ORDER 0x080 25 | #define SHF_OS_NONCONFORMING 0x100 26 | #define SHF_GROUP 0x200 27 | #define SHF_TLS 0x400 28 | 29 | 30 | #define R_ARM_ABS32 0x02 31 | #define R_ARM_THM_CALL 0x0a 32 | #define R_ARM_THM_JUMP24 0x1e 33 | #define R_ARM_TARGET1 0x26 34 | 35 | #define STT_NOTYPE 0 36 | #define STT_OBJECT 1 37 | #define STT_FUNC 2 38 | #define STT_SECTION 3 39 | #define STT_FILE 4 40 | #define STT_LOPROC 5 41 | #define STT_HIPROC 6 42 | #define STB_LOCAL 7 43 | #define STB_GLOBAL 8 44 | #define STB_WEAK 9 45 | #define STB_LOPROC ?? 46 | #define STB_HIPROC ?? 47 | 48 | #pragma pack(1) 49 | typedef struct ElfHeader { 50 | uint8_t e_ident[16]; 51 | uint16_t e_type; 52 | uint16_t e_machine; 53 | uint32_t e_version; 54 | uint32_t e_entry; 55 | uint32_t e_phoff; 56 | uint32_t e_shoff; 57 | uint32_t e_flags; 58 | uint16_t e_ehsize; 59 | uint16_t e_phentsize; 60 | uint16_t e_phnum; 61 | uint16_t e_shentsize; 62 | uint16_t e_shnum; 63 | uint16_t e_shstrndx; 64 | } ElfHeader; 65 | 66 | #pragma pack(1) 67 | typedef struct SectionHeader { 68 | uint32_t sh_name; 69 | uint32_t sh_type; 70 | uint32_t sh_flags; 71 | uint32_t sh_addr; 72 | uint32_t sh_offset; 73 | uint32_t sh_size; 74 | uint32_t sh_link; 75 | uint32_t sh_info; 76 | uint32_t sh_addralign; 77 | uint32_t sh_entsize; 78 | } SectionHeader; 79 | 80 | #pragma pack(1) 81 | typedef struct RelEntry { 82 | uint32_t offset; 83 | uint32_t info; 84 | } RelEntry; 85 | 86 | #pragma pack(1) 87 | typedef struct SymbolEntry { 88 | uint32_t st_name; //index to string table 89 | uint32_t st_value; 90 | uint32_t st_size; 91 | unsigned char st_info; 92 | unsigned char st_other; // unused, 0 93 | uint16_t st_shndx; 94 | } SymbolEntry; 95 | 96 | typedef struct SectionMetaEntry { 97 | SectionHeader* header; 98 | uint32_t loadAddress; 99 | char* name; 100 | SectionHeader* relocation; 101 | uint8_t* buffer; 102 | } SectionMetaEntry; 103 | 104 | typedef struct NameAddressMapEntry { 105 | uint32_t address; 106 | char* name; 107 | } NameAddressMapEntry; 108 | 109 | extern NameAddressMapEntry NameAddressMap[43]; 110 | 111 | int isElf(uint32_t size, uint8_t* buffer); 112 | 113 | int initSectionsMeta(uint8_t* elfBuffer, SectionMetaEntry meta[], uint32_t nobitsLoadAddress); 114 | 115 | int loadElf(uint8_t* elfBuffer, uint32_t metaCount, SectionMetaEntry meta[], uint32_t* pMainAddress, int* usesVcsWrite3); 116 | 117 | void runPreInitFuncs(uint32_t metaCount, SectionMetaEntry meta[]); 118 | void runInitFuncs(uint32_t metaCount, SectionMetaEntry meta[]); 119 | 120 | int relocateSection( 121 | SectionMetaEntry* sectionMeta, 122 | SectionHeader* symTableSectionHeader, 123 | SectionHeader* pSymStringSection, 124 | uint8_t* elfBuffer, 125 | SectionMetaEntry meta[] 126 | ); 127 | 128 | #endif // ELFLIB_H 129 | -------------------------------------------------------------------------------- /source/STM32firmware/PlusCart/Inc/flash.h: -------------------------------------------------------------------------------- 1 | #ifndef FLASH_H 2 | #define FLASH_H 3 | 4 | #ifdef __cplusplus 5 | extern "C" { 6 | #endif 7 | 8 | #include 9 | #include "stm32f4xx_hal.h" 10 | #include "global.h" 11 | 12 | 13 | /* Base address of the Flash sectors */ 14 | #define ADDR_FLASH_SECTOR_0 ((uint32_t)0x08000000) /* Base @ of Sector 0, 16 Kbytes */ 15 | #define ADDR_FLASH_SECTOR_1 ((uint32_t)0x08004000) /* Base @ of Sector 1, 16 Kbytes */ 16 | #define ADDR_FLASH_SECTOR_2 ((uint32_t)0x08008000) /* Base @ of Sector 2, 16 Kbytes */ 17 | #define ADDR_FLASH_SECTOR_3 ((uint32_t)0x0800C000) /* Base @ of Sector 3, 16 Kbytes */ 18 | #define ADDR_FLASH_SECTOR_4 ((uint32_t)0x08010000) /* Base @ of Sector 4, 64 Kbytes */ 19 | #define ADDR_FLASH_SECTOR_5 ((uint32_t)0x08020000) /* Base @ of Sector 5, 128 Kbytes */ 20 | #define ADDR_FLASH_SECTOR_6 ((uint32_t)0x08040000) /* Base @ of Sector 6, 128 Kbytes */ 21 | #define ADDR_FLASH_SECTOR_7 ((uint32_t)0x08060000) /* Base @ of Sector 7, 128 Kbytes */ 22 | #define ADDR_FLASH_SECTOR_8 ((uint32_t)0x08080000) /* Base @ of Sector 8, 128 Kbytes */ 23 | #define ADDR_FLASH_SECTOR_9 ((uint32_t)0x080A0000) /* Base @ of Sector 9, 128 Kbytes */ 24 | #define ADDR_FLASH_SECTOR_10 ((uint32_t)0x080C0000) /* Base @ of Sector 10, 128 Kbytes */ 25 | #define ADDR_FLASH_SECTOR_11 ((uint32_t)0x080E0000) /* Base @ of Sector 11, 128 Kbytes */ 26 | #define ADDR_FLASH_SECTOR_12 ((uint32_t)0x08100000) /* Base @ of !virtual! Sector 12, 0 Kbytes */ 27 | 28 | #define FLASH_TIMEOUT_VALUE 50000U /* 50 s */ 29 | 30 | 31 | // eeprom emulation defines 32 | #define EEPROM_SECTOR_ID FLASH_SECTOR_1 33 | #define EEPROM_START_ADDRESS ADDR_FLASH_SECTOR_1 34 | #define EEPROM_SIZE ((uint32_t)0x4000) 35 | 36 | #define EEPROM_EMPTY_PAGE_HEADER ((uint32_t)0xFFFFFFFF) 37 | #define EEPROM_ACTIVE_PAGE_HEADER ((uint32_t)0x5555FFFF) 38 | #define EEPROM_INVALID_PAGE_HEADER ((uint32_t)0x55555555) 39 | 40 | #define EEPROM_EMPTY_ENTRY_HEADER ((uint16_t)0xFFFF) 41 | #define EEPROM_ACTIVE_ENTRY_HEADER ((uint16_t)0x55FF) 42 | #define EEPROM_INVALID_ENTRY_HEADER ((uint16_t)0x5555) 43 | 44 | #define EEPROM_PAGE_HEADER_SIZE sizeof(EEPROM_EMPTY_PAGE_HEADER) 45 | #define EEPROM_ENTRY_HEADER_SIZE sizeof(EEPROM_EMPTY_ENTRY_HEADER) 46 | #define EEPROM_PAGE_SIZE 512 // 4 byte page header + 508 byte for entries 47 | #define EEPROM_ENTRY_SIZE 39 // 2 byte entry header + 37 byte payload 48 | 49 | #define EEPROM_MAX_PAGE_ID ((uint8_t)(EEPROM_SIZE / EEPROM_PAGE_SIZE ) -1) 50 | #define EEPROM_MAX_ENTRY_ID ((uint8_t)((EEPROM_PAGE_SIZE - EEPROM_PAGE_HEADER_SIZE) / EEPROM_ENTRY_SIZE) - 1) 51 | 52 | // Download Area in Flash 53 | #define FIRST_FREE_SECTOR FLASH_SECTOR_5 54 | #define DOWNLOAD_AREA_START_ADDRESS ((uint32_t)ADDR_FLASH_SECTOR_5) 55 | #define TAR_HEADER_SIZE 512 56 | #define TAR_BLOCK_SIZE 512 57 | 58 | void flash_firmware_update(uint32_t)__attribute__((section(".data#"))); 59 | 60 | uint32_t flash_download(char *, uint32_t , uint32_t , bool ); 61 | void flash_download_at(char *filename, uint32_t download_size, uint32_t file_offset, uint8_t* flash_address); 62 | void flash_buffer_at(uint8_t* buffer, uint32_t buffer_size, uint8_t* flash_address); 63 | 64 | uint32_t flash_file_request( uint8_t *, uint32_t, uint32_t, uint32_t ); 65 | 66 | bool flash_has_downloaded_roms(void); 67 | 68 | void flash_file_list(char *, MENU_ENTRY **, int *); 69 | uint32_t flash_check_offline_roms_size(void); 70 | 71 | void flash_erase_storage(uint8_t); 72 | 73 | USER_SETTINGS flash_get_eeprom_user_settings(void); 74 | void flash_set_eeprom_user_settings(USER_SETTINGS); 75 | void flash_erase_eeprom(); 76 | 77 | #ifdef __cplusplus 78 | } 79 | #endif 80 | 81 | #endif /* FLASH_H */ 82 | -------------------------------------------------------------------------------- /source/STM32firmware/PlusCart/Src/cartridge_emulation_df.c: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | #include 4 | #include "cartridge_emulation.h" 5 | #include "cartridge_setup.h" 6 | #include "cartridge_emulation_df.h" 7 | #include "cartridge_firmware.h" 8 | 9 | #define STARTUP_BANK_BF 1 10 | #define STARTUP_BANK_BFSC 15 11 | 12 | void emulate_dfsc_cartridge(const char* filename, uint32_t image_size, uint8_t* buffer, MENU_ENTRY *d ) { 13 | 14 | cartridge_layout * layout = (cartridge_layout *) malloc( sizeof( cartridge_layout )); 15 | uint8_t* ram = buffer; 16 | 17 | if (!setup_cartridge_image(filename, image_size, buffer, layout, d, base_type_DFSC)) return; 18 | 19 | uint8_t *bank = layout->banks[STARTUP_BANK_BFSC]; 20 | bool joy_status = false; 21 | 22 | if (!reboot_into_cartridge()) return; 23 | __disable_irq(); 24 | 25 | uint16_t addr, addr_prev = 0, addr_prev2 = 0; 26 | uint8_t data = 0, data_prev = 0; 27 | 28 | while (1) 29 | { 30 | while (((addr = ADDR_IN) != addr_prev) || (addr != addr_prev2)) 31 | { 32 | addr_prev2 = addr_prev; 33 | addr_prev = addr; 34 | } 35 | 36 | if (addr & 0x1000){ 37 | 38 | uint16_t address = addr & 0x0fff; 39 | 40 | if (address < 0x80) { 41 | while (ADDR_IN == addr) { data_prev = data; data = DATA_IN; } 42 | data = data_prev; 43 | 44 | ram[address] = (uint8_t) data; 45 | } else { 46 | if (address >= 0x0fc0 && address <= 0x0fdf) bank = layout->banks[address - 0x0fc0]; 47 | 48 | data = (address < 0x0100) ? ram[address & 0x7f] : bank[address]; 49 | 50 | DATA_OUT = data; 51 | SET_DATA_MODE_OUT 52 | // wait for address bus to change 53 | while (ADDR_IN == addr) ; 54 | SET_DATA_MODE_IN 55 | } 56 | }else{ 57 | if(addr == EXIT_SWCHB_ADDR){ 58 | while (ADDR_IN == addr) { data_prev = data; data = DATA_IN; } 59 | if( !(data_prev & 0x1) && joy_status) 60 | break; 61 | }else if(addr == SWCHA){ 62 | while (ADDR_IN == addr) { data_prev = data; data = DATA_IN; } 63 | joy_status = !(data_prev & 0x80); 64 | } 65 | } 66 | 67 | } 68 | exit_cartridge(addr, addr_prev); 69 | 70 | free(layout); 71 | } 72 | 73 | void emulate_df_cartridge(const char* filename, uint32_t image_size, uint8_t* buffer, MENU_ENTRY *d ) { 74 | cartridge_layout * layout = (cartridge_layout *) malloc( sizeof( cartridge_layout )); 75 | 76 | if (!setup_cartridge_image(filename, image_size, buffer, layout, d, base_type_DF)) return; 77 | 78 | uint8_t *bank = layout->banks[STARTUP_BANK_BF]; 79 | bool joy_status = false; 80 | 81 | if (!reboot_into_cartridge()) return; 82 | __disable_irq(); 83 | 84 | uint16_t addr, addr_prev = 0, addr_prev2 = 0; 85 | uint8_t data = 0, data_prev = 0; 86 | 87 | while (1) 88 | { 89 | while (((addr = ADDR_IN) != addr_prev) || (addr != addr_prev2)) 90 | { 91 | addr_prev2 = addr_prev; 92 | addr_prev = addr; 93 | } 94 | 95 | if (addr & 0x1000){ 96 | uint16_t address = addr & 0x0fff; 97 | 98 | if (address >= 0x0fc0 && address <= 0x0fdf) bank = layout->banks[address - 0x0fc0]; 99 | 100 | DATA_OUT = bank[address]; 101 | SET_DATA_MODE_OUT 102 | // wait for address bus to change 103 | while (ADDR_IN == addr) ; 104 | SET_DATA_MODE_IN 105 | }else{ 106 | if(addr == EXIT_SWCHB_ADDR){ 107 | while (ADDR_IN == addr) { data_prev = data; data = DATA_IN; } 108 | if( !(data_prev & 0x1) && joy_status) 109 | break; 110 | }else if(addr == SWCHA){ 111 | while (ADDR_IN == addr) { data_prev = data; data = DATA_IN; } 112 | joy_status = !(data_prev & 0x80); 113 | } 114 | } 115 | } 116 | exit_cartridge(addr, addr_prev); 117 | 118 | free(layout); 119 | } 120 | -------------------------------------------------------------------------------- /source/STM32firmware/PlusCart/Src/cartridge_emulation_bf.c: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | #include 4 | #include "cartridge_emulation.h" 5 | #include "cartridge_setup.h" 6 | #include "cartridge_emulation_bf.h" 7 | #include "cartridge_firmware.h" 8 | 9 | #define STARTUP_BANK_BF 1 10 | #define STARTUP_BANK_BFSC 15 11 | 12 | void emulate_bfsc_cartridge(const char* filename, uint32_t image_size, uint8_t* buffer, MENU_ENTRY *d) { 13 | 14 | cartridge_layout * layout = (cartridge_layout *) malloc( sizeof( cartridge_layout )); 15 | uint8_t* ram = buffer; 16 | 17 | if (!setup_cartridge_image(filename, image_size, buffer, layout, d, base_type_BFSC)) return; 18 | 19 | uint8_t *bank = layout->banks[STARTUP_BANK_BFSC]; 20 | bool joy_status = false; 21 | 22 | if (!reboot_into_cartridge()) return; 23 | __disable_irq(); 24 | 25 | uint16_t addr, addr_prev = 0, addr_prev2 = 0; 26 | uint8_t data = 0, data_prev = 0; 27 | 28 | while (1) 29 | { 30 | while (((addr = ADDR_IN) != addr_prev) || (addr != addr_prev2)) 31 | { 32 | addr_prev2 = addr_prev; 33 | addr_prev = addr; 34 | } 35 | 36 | if (addr & 0x1000){ 37 | uint16_t address = addr & 0x0fff; 38 | 39 | if (address < 0x80) { 40 | while (ADDR_IN == addr) { data_prev = data; data = DATA_IN; } 41 | data = data_prev; 42 | 43 | ram[address] = (uint8_t) data; 44 | } else { 45 | if (address >= 0x0f80 && address <= 0x0fbf) bank = layout->banks[address - 0x0f80]; 46 | 47 | data = (address < 0x0100) ? ram[address & 0x7f] : bank[address]; 48 | 49 | DATA_OUT = data; 50 | SET_DATA_MODE_OUT 51 | // wait for address bus to change 52 | while (ADDR_IN == addr) ; 53 | SET_DATA_MODE_IN 54 | } 55 | 56 | }else{ 57 | if(addr == EXIT_SWCHB_ADDR){ 58 | while (ADDR_IN == addr) { data_prev = data; data = DATA_IN; } 59 | if( !(data_prev & 0x1) && joy_status) 60 | break; 61 | }else if(addr == SWCHA){ 62 | while (ADDR_IN == addr) { data_prev = data; data = DATA_IN; } 63 | joy_status = !(data_prev & 0x80); 64 | } 65 | } 66 | 67 | } 68 | exit_cartridge(addr, addr_prev); 69 | 70 | free(layout); 71 | } 72 | 73 | void emulate_bf_cartridge(const char* filename, uint32_t image_size, uint8_t* buffer, MENU_ENTRY *d ) { 74 | cartridge_layout * layout = (cartridge_layout *) malloc( sizeof( cartridge_layout )); 75 | 76 | if (!setup_cartridge_image(filename, image_size, buffer, layout, d, base_type_BF)) return; 77 | 78 | uint8_t *bank = layout->banks[STARTUP_BANK_BF]; 79 | bool joy_status = false; 80 | 81 | if (!reboot_into_cartridge()) return; 82 | __disable_irq(); 83 | 84 | uint16_t addr, addr_prev = 0, addr_prev2 = 0; 85 | uint8_t data = 0, data_prev = 0; 86 | 87 | while (1) 88 | { 89 | while (((addr = ADDR_IN) != addr_prev) || (addr != addr_prev2)) 90 | { 91 | addr_prev2 = addr_prev; 92 | addr_prev = addr; 93 | } 94 | 95 | if (addr & 0x1000){ 96 | uint16_t address = addr & 0x0fff; 97 | 98 | if (address >= 0x0f80 && address <= 0x0fbf) bank = layout->banks[address - 0x0f80]; 99 | 100 | DATA_OUT = bank[address]; 101 | SET_DATA_MODE_OUT 102 | // wait for address bus to change 103 | while (ADDR_IN == addr) ; 104 | SET_DATA_MODE_IN 105 | }else{ 106 | if(addr == EXIT_SWCHB_ADDR){ 107 | while (ADDR_IN == addr) { data_prev = data; data = DATA_IN; } 108 | if( !(data_prev & 0x1) && joy_status) 109 | break; 110 | }else if(addr == SWCHA){ 111 | while (ADDR_IN == addr) { data_prev = data; data = DATA_IN; } 112 | joy_status = !(data_prev & 0x80); 113 | } 114 | } 115 | } 116 | exit_cartridge(addr, addr_prev); 117 | 118 | free(layout); 119 | } 120 | -------------------------------------------------------------------------------- /source/STM32firmware/PlusCart/Drivers/CMSIS/Device/ST/STM32F4xx/Include/system_stm32f4xx.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file system_stm32f4xx.h 4 | * @author MCD Application Team 5 | * @brief CMSIS Cortex-M4 Device System Source File for STM32F4xx devices. 6 | ****************************************************************************** 7 | * @attention 8 | * 9 | *

© COPYRIGHT(c) 2017 STMicroelectronics

10 | * 11 | * Redistribution and use in source and binary forms, with or without modification, 12 | * are permitted provided that the following conditions are met: 13 | * 1. Redistributions of source code must retain the above copyright notice, 14 | * this list of conditions and the following disclaimer. 15 | * 2. Redistributions in binary form must reproduce the above copyright notice, 16 | * this list of conditions and the following disclaimer in the documentation 17 | * and/or other materials provided with the distribution. 18 | * 3. Neither the name of STMicroelectronics nor the names of its contributors 19 | * may be used to endorse or promote products derived from this software 20 | * without specific prior written permission. 21 | * 22 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 23 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 24 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 25 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 26 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 27 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 28 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 29 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 30 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 31 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 | * 33 | ****************************************************************************** 34 | */ 35 | 36 | /** @addtogroup CMSIS 37 | * @{ 38 | */ 39 | 40 | /** @addtogroup stm32f4xx_system 41 | * @{ 42 | */ 43 | 44 | /** 45 | * @brief Define to prevent recursive inclusion 46 | */ 47 | #ifndef __SYSTEM_STM32F4XX_H 48 | #define __SYSTEM_STM32F4XX_H 49 | 50 | #ifdef __cplusplus 51 | extern "C" { 52 | #endif 53 | 54 | /** @addtogroup STM32F4xx_System_Includes 55 | * @{ 56 | */ 57 | 58 | /** 59 | * @} 60 | */ 61 | 62 | 63 | /** @addtogroup STM32F4xx_System_Exported_types 64 | * @{ 65 | */ 66 | /* This variable is updated in three ways: 67 | 1) by calling CMSIS function SystemCoreClockUpdate() 68 | 2) by calling HAL API function HAL_RCC_GetSysClockFreq() 69 | 3) each time HAL_RCC_ClockConfig() is called to configure the system clock frequency 70 | Note: If you use this function to configure the system clock; then there 71 | is no need to call the 2 first functions listed above, since SystemCoreClock 72 | variable is updated automatically. 73 | */ 74 | extern uint32_t SystemCoreClock; /*!< System Clock Frequency (Core Clock) */ 75 | 76 | extern const uint8_t AHBPrescTable[16]; /*!< AHB prescalers table values */ 77 | extern const uint8_t APBPrescTable[8]; /*!< APB prescalers table values */ 78 | 79 | /** 80 | * @} 81 | */ 82 | 83 | /** @addtogroup STM32F4xx_System_Exported_Constants 84 | * @{ 85 | */ 86 | 87 | /** 88 | * @} 89 | */ 90 | 91 | /** @addtogroup STM32F4xx_System_Exported_Macros 92 | * @{ 93 | */ 94 | 95 | /** 96 | * @} 97 | */ 98 | 99 | /** @addtogroup STM32F4xx_System_Exported_Functions 100 | * @{ 101 | */ 102 | 103 | extern void SystemInit(void); 104 | extern void SystemCoreClockUpdate(void); 105 | /** 106 | * @} 107 | */ 108 | 109 | #ifdef __cplusplus 110 | } 111 | #endif 112 | 113 | #endif /*__SYSTEM_STM32F4XX_H */ 114 | 115 | /** 116 | * @} 117 | */ 118 | 119 | /** 120 | * @} 121 | */ 122 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 123 | -------------------------------------------------------------------------------- /source/STM32firmware/PlusCart/Inc/main.h: -------------------------------------------------------------------------------- 1 | /* USER CODE BEGIN Header */ 2 | /** 3 | ****************************************************************************** 4 | * File : main.h 5 | * Brief : PlusCart(+) Firmware 6 | * Author : Wolfgang Stubig 7 | * Website : https://gitlab.com/firmaplus/atari-2600-pluscart 8 | ****************************************************************************** 9 | * (c) 2019 Wolfgang Stubig (Al_Nafuur) 10 | * based on: UnoCart2600 by Robin Edwards (ElectroTrains) 11 | * https://github.com/robinhedwards/UnoCart-2600 12 | * and 13 | * UnoCart2600 fork by Christian Speckner (DirtyHairy) 14 | * https://github.com/DirtyHairy/UnoCart-2600 15 | ****************************************************************************** 16 | * This program is free software: you can redistribute it and/or modify 17 | * it under the terms of the GNU General Public License as published by 18 | * the Free Software Foundation, either version 3 of the License, or 19 | * (at your option) any later version. 20 | * 21 | * This program is distributed in the hope that it will be useful, 22 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 23 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 24 | * GNU General Public License for more details. 25 | * 26 | * You should have received a copy of the GNU General Public License 27 | * along with this program. If not, see . 28 | ****************************************************************************** 29 | */ 30 | /* USER CODE END Header */ 31 | 32 | /* Define to prevent recursive inclusion -------------------------------------*/ 33 | #ifndef __MAIN_H 34 | #define __MAIN_H 35 | 36 | #ifdef __cplusplus 37 | extern "C" { 38 | #endif 39 | 40 | /* Includes ------------------------------------------------------------------*/ 41 | #include "stm32f4xx_hal.h" 42 | 43 | /* Private includes ----------------------------------------------------------*/ 44 | /* USER CODE BEGIN Includes */ 45 | 46 | /* USER CODE END Includes */ 47 | 48 | /* Exported types ------------------------------------------------------------*/ 49 | /* USER CODE BEGIN ET */ 50 | 51 | 52 | 53 | 54 | /* USER CODE END ET */ 55 | 56 | /* Exported constants --------------------------------------------------------*/ 57 | /* USER CODE BEGIN EC */ 58 | 59 | /* USER CODE END EC */ 60 | 61 | /* Exported macro ------------------------------------------------------------*/ 62 | /* USER CODE BEGIN EM */ 63 | 64 | /* USER CODE END EM */ 65 | 66 | /* Exported functions prototypes ---------------------------------------------*/ 67 | void Error_Handler(void); 68 | 69 | /* USER CODE BEGIN EFP */ 70 | 71 | /* USER CODE END EFP */ 72 | 73 | /* Private defines -----------------------------------------------------------*/ 74 | #define SD_CS_Pin GPIO_PIN_5 75 | #define SD_CS_GPIO_Port GPIOB 76 | /* USER CODE BEGIN Private defines */ 77 | 78 | #define SD_SPI_HANDLE hspi2 79 | 80 | #define BUFFER_SIZE 96 // kilobytes 81 | #define CCM_RAM_SIZE 64 // kilobytes 82 | #define CCM_RAM ((uint8_t*)0x10000000) 83 | 84 | 85 | enum e_status_message { 86 | STATUS_NONE = -2, 87 | STATUS_MESSAGE_STRING, 88 | STATUS_ROOT, 89 | select_wifi_network, 90 | wifi_not_connected, 91 | wifi_connected, 92 | esp_timeout, 93 | insert_password, 94 | plus_connect, 95 | STATUS_YOUR_MESSAGE, 96 | offline_roms_deleted, 97 | not_enough_menory, 98 | romtype_ACE_unsupported, 99 | romtype_unknown, 100 | done, 101 | failed, 102 | download_failed, 103 | offline_roms_detected, 104 | no_offline_roms_detected, 105 | romtype_DPCplus_unsupported, 106 | exit_emulation, 107 | rom_download_failed, 108 | 109 | STATUS_SETUP, 110 | STATUS_SETUP_TV_MODE, 111 | STATUS_SETUP_FONT_STYLE, 112 | STATUS_SETUP_LINE_SPACING, 113 | STATUS_SETUP_SYSTEM_INFO, 114 | STATUS_SEARCH_FOR_ROM, 115 | STATUS_SEARCH_DETAILS, 116 | STATUS_CHOOSE_ROM, 117 | STATUS_HOST_OR_IP, 118 | 119 | STATUS_APPEARANCE, 120 | 121 | }; 122 | 123 | /* USER CODE END Private defines */ 124 | 125 | #ifdef __cplusplus 126 | } 127 | #endif 128 | 129 | #endif /* __MAIN_H */ 130 | 131 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 132 | -------------------------------------------------------------------------------- /source/STM32firmware/PlusCart/Src/cartridge_emulation_ELF.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | //#include "flash.h" 6 | #include "cartridge_emulation.h" 7 | #include "cartridge_emulation_ELF.h" 8 | #include "cartridge_firmware.h" 9 | #include "vcsLib.h" 10 | #include "global.h" 11 | 12 | #define NTSC_CLOCK 1193182UL 13 | #define PAL_CLOCK 1182298UL 14 | 15 | 16 | NameAddressMapEntry NameAddressMap[] = { 17 | // Color lookup table is updated based on detected system. Keep at index 0 18 | {(uint32_t)&Ntsc2600[0], "ColorLookup" }, 19 | // Low level bus access - handy for distributing prototype banking schemes without updating firmware 20 | {(uint32_t)&ADDR_IDR, "ADDR_IDR" }, 21 | {(uint32_t)&DATA_IDR, "DATA_IDR" }, 22 | {(uint32_t)&DATA_ODR, "DATA_ODR" }, 23 | {(uint32_t)&DATA_MODER, "DATA_MODER" }, 24 | // Used by GCC/CRT 25 | {(uint32_t)memset, "memset" }, 26 | {(uint32_t)memcpy, "memcpy" }, 27 | // Strong-ARM framework 28 | {(uint32_t)&ReverseByte[0], "ReverseByte" }, 29 | {(uint32_t)vcsLdaForBusStuff2, "vcsLdaForBusStuff2" }, 30 | {(uint32_t)vcsLdxForBusStuff2, "vcsLdxForBusStuff2" }, 31 | {(uint32_t)vcsLdyForBusStuff2, "vcsLdyForBusStuff2" }, 32 | {(uint32_t)vcsWrite3, "vcsWrite3" }, 33 | {(uint32_t)vcsWrite4, "vcsWrite4" }, 34 | {(uint32_t)vcsJmp3, "vcsJmp3" }, 35 | {(uint32_t)vcsNop2, "vcsNop2" }, 36 | {(uint32_t)vcsNop2n, "vcsNop2n" }, 37 | {(uint32_t)vcsWrite5, "vcsWrite5" }, 38 | {(uint32_t)vcsWrite6, "vcsWrite6" }, 39 | {(uint32_t)vcsLda2, "vcsLda2" }, 40 | {(uint32_t)vcsLdx2, "vcsLdx2" }, 41 | {(uint32_t)vcsLdy2, "vcsLdy2" }, 42 | {(uint32_t)vcsSax3, "vcsSax3" }, 43 | {(uint32_t)vcsSta3, "vcsSta3" }, 44 | {(uint32_t)vcsStx3, "vcsStx3" }, 45 | {(uint32_t)vcsSty3, "vcsSty3" }, 46 | {(uint32_t)vcsSta4, "vcsSta4" }, 47 | {(uint32_t)vcsStx4, "vcsStx4" }, 48 | {(uint32_t)vcsSty4, "vcsSty4" }, 49 | {(uint32_t)vcsCopyOverblankToRiotRam, "vcsCopyOverblankToRiotRam" }, 50 | {(uint32_t)vcsStartOverblank, "vcsStartOverblank" }, 51 | {(uint32_t)vcsEndOverblank, "vcsEndOverblank" }, 52 | {(uint32_t)vcsRead4, "vcsRead4" }, 53 | {(uint32_t)randint, "randint" }, 54 | {(uint32_t)vcsTxs2, "vcsTxs2" }, 55 | {(uint32_t)vcsJsr6, "vcsJsr6" }, 56 | {(uint32_t)vcsPha3, "vcsPha3" }, 57 | {(uint32_t)vcsPhp3, "vcsPhp3" }, 58 | {(uint32_t)vcsPla4, "vcsPla4" }, 59 | {(uint32_t)vcsPlp4, "vcsPlp4" }, 60 | {(uint32_t)vcsPla4Ex, "vcsPla4Ex" }, 61 | {(uint32_t)vcsPlp4Ex, "vcsPlp4Ex" }, 62 | {(uint32_t)vcsJmpToRam3, "vcsJmpToRam3" }, 63 | {(uint32_t)vcsWaitForAddress, "vcsWaitForAddress" }, 64 | {(uint32_t)injectDmaData, "injectDmaData" }, 65 | }; 66 | 67 | int launch_elf_file(const char* filename, uint32_t buffer_size, uint8_t* buffer) 68 | { 69 | uint32_t mainArgs[MP_COUNT] = 70 | { 71 | 0, // MP_SYSTEM_TYPE (TBD below) 0 72 | SystemCoreClock, // MP_CLOCK_HZ 1 73 | FF_MULTI_CART, // MP_FEARTURE_FLAGS 2 74 | }; 75 | 76 | // Transfer control back to ROM 77 | __disable_irq(); 78 | vcsLibInit(); 79 | 80 | switch(user_settings.tv_mode) 81 | { 82 | case TV_MODE_PAL: 83 | mainArgs[MP_SYSTEM_TYPE] = ST_PAL_2600; 84 | break; 85 | case TV_MODE_PAL60: 86 | mainArgs[MP_SYSTEM_TYPE] = ST_PAL60_2600; 87 | break; 88 | default: 89 | case TV_MODE_NTSC: 90 | mainArgs[MP_SYSTEM_TYPE] = ST_NTSC_2600; 91 | break; 92 | } 93 | 94 | if(mainArgs[MP_SYSTEM_TYPE] == ST_PAL_2600 || mainArgs[MP_SYSTEM_TYPE] == ST_PAL60_2600) 95 | NameAddressMap[0].address = (uint32_t)&Pal2600[0]; 96 | 97 | int usesBusStuffing; 98 | uint32_t pMainAddress; 99 | uint32_t metaCount = ((ElfHeader*)buffer)->e_shnum; 100 | SectionMetaEntry* meta = malloc(sizeof(SectionMetaEntry) * metaCount); 101 | if (!initSectionsMeta(buffer, meta, (uint32_t)CCM_RAM)) 102 | { 103 | exit_cartridge(0x1100, 0x1000); 104 | return 0; 105 | } 106 | if (!loadElf(buffer, metaCount, meta, &pMainAddress, &usesBusStuffing)) 107 | { 108 | exit_cartridge(0x1100, 0x1000); 109 | return 0; 110 | } 111 | 112 | runPreInitFuncs(metaCount, meta); 113 | runInitFuncs(metaCount, meta); 114 | 115 | if(usesBusStuffing) 116 | vcsInitBusStuffing(); 117 | 118 | vcsEndOverblank(); 119 | vcsNop2n(1024); 120 | 121 | // Run game 122 | ((void (*)())pMainAddress)(mainArgs); 123 | 124 | // elf rom should have jumped to 0x1000 and put nop on bus 125 | exit_cartridge(0x1100, 0x1000); 126 | 127 | return 1; 128 | } 129 | -------------------------------------------------------------------------------- /source/STM32firmware/PlusCart/Middlewares/Third_Party/FatFs/src/ff_gen_drv.c: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file ff_gen_drv.c 4 | * @author MCD Application Team 5 | * @brief FatFs generic low level driver. 6 | ***************************************************************************** 7 | * @attention 8 | * 9 | * Copyright (c) 2017 STMicroelectronics. All rights reserved. 10 | * 11 | * This software component is licensed by ST under BSD 3-Clause license, 12 | * the "License"; You may not use this file except in compliance with the 13 | * License. You may obtain a copy of the License at: 14 | * opensource.org/licenses/BSD-3-Clause 15 | * 16 | ****************************************************************************** 17 | **/ 18 | /* Includes ------------------------------------------------------------------*/ 19 | #include "ff_gen_drv.h" 20 | 21 | /* Private typedef -----------------------------------------------------------*/ 22 | /* Private define ------------------------------------------------------------*/ 23 | /* Private variables ---------------------------------------------------------*/ 24 | Disk_drvTypeDef disk = {{0},{0},{0},0}; 25 | 26 | /* Private function prototypes -----------------------------------------------*/ 27 | /* Private functions ---------------------------------------------------------*/ 28 | 29 | /** 30 | * @brief Links a compatible diskio driver/lun id and increments the number of active 31 | * linked drivers. 32 | * @note The number of linked drivers (volumes) is up to 10 due to FatFs limits. 33 | * @param drv: pointer to the disk IO Driver structure 34 | * @param path: pointer to the logical drive path 35 | * @param lun : only used for USB Key Disk to add multi-lun management 36 | else the parameter must be equal to 0 37 | * @retval Returns 0 in case of success, otherwise 1. 38 | */ 39 | uint8_t FATFS_LinkDriverEx(const Diskio_drvTypeDef *drv, char *path, uint8_t lun) 40 | { 41 | uint8_t ret = 1; 42 | uint8_t DiskNum = 0; 43 | 44 | if(disk.nbr < _VOLUMES) 45 | { 46 | disk.is_initialized[disk.nbr] = 0; 47 | disk.drv[disk.nbr] = drv; 48 | disk.lun[disk.nbr] = lun; 49 | DiskNum = disk.nbr++; 50 | path[0] = DiskNum + '0'; 51 | path[1] = ':'; 52 | path[2] = '/'; 53 | path[3] = 0; 54 | ret = 0; 55 | } 56 | 57 | return ret; 58 | } 59 | 60 | /** 61 | * @brief Links a compatible diskio driver and increments the number of active 62 | * linked drivers. 63 | * @note The number of linked drivers (volumes) is up to 10 due to FatFs limits 64 | * @param drv: pointer to the disk IO Driver structure 65 | * @param path: pointer to the logical drive path 66 | * @retval Returns 0 in case of success, otherwise 1. 67 | */ 68 | uint8_t FATFS_LinkDriver(const Diskio_drvTypeDef *drv, char *path) 69 | { 70 | return FATFS_LinkDriverEx(drv, path, 0); 71 | } 72 | 73 | /** 74 | * @brief Unlinks a diskio driver and decrements the number of active linked 75 | * drivers. 76 | * @param path: pointer to the logical drive path 77 | * @param lun : not used 78 | * @retval Returns 0 in case of success, otherwise 1. 79 | */ 80 | uint8_t FATFS_UnLinkDriverEx(char *path, uint8_t lun) 81 | { 82 | uint8_t DiskNum = 0; 83 | uint8_t ret = 1; 84 | 85 | if(disk.nbr >= 1) 86 | { 87 | DiskNum = path[0] - '0'; 88 | if(disk.drv[DiskNum] != 0) 89 | { 90 | disk.drv[DiskNum] = 0; 91 | disk.lun[DiskNum] = 0; 92 | disk.nbr--; 93 | ret = 0; 94 | } 95 | } 96 | 97 | return ret; 98 | } 99 | 100 | /** 101 | * @brief Unlinks a diskio driver and decrements the number of active linked 102 | * drivers. 103 | * @param path: pointer to the logical drive path 104 | * @retval Returns 0 in case of success, otherwise 1. 105 | */ 106 | uint8_t FATFS_UnLinkDriver(char *path) 107 | { 108 | return FATFS_UnLinkDriverEx(path, 0); 109 | } 110 | 111 | /** 112 | * @brief Gets number of linked drivers to the FatFs module. 113 | * @param None 114 | * @retval Number of attached drivers. 115 | */ 116 | uint8_t FATFS_GetAttachedDriversNbr(void) 117 | { 118 | return disk.nbr; 119 | } 120 | 121 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 122 | 123 | -------------------------------------------------------------------------------- /source/STM32firmware/PlusCart/Inc/firmware_pal_rom.h: -------------------------------------------------------------------------------- 1 | // see firmware_ntsc_rom.h for instructions 2 | 3 | unsigned const char firmware_pal_rom[]__attribute__((section(".flash0"))) = { 4 | 5 | 0xd8, 0x8d, 0xf4, 0xff, 0x4c, 0x72, 0x12, 0x9d, 0xf5, 0xff, 0xd8, 0xa9, 6 | 0x00, 0xaa, 0xca, 0x9a, 0xba, 0x48, 0xd0, 0xfc, 0x8d, 0x80, 0x02, 0x8d, 7 | 0x81, 0x02, 0x8d, 0x82, 0x02, 0x8d, 0x83, 0x02, 0xad, 0xf4, 0x1f, 0x20, 8 | 0x37, 0x11, 0x20, 0x50, 0x11, 0xa2, 0xff, 0x20, 0xa4, 0x00, 0x20, 0x5b, 9 | 0x10, 0xad, 0x80, 0x02, 0x10, 0xfb, 0x20, 0x15, 0x11, 0x20, 0x77, 0x10, 10 | 0x20, 0x50, 0x11, 0xa6, 0x80, 0x20, 0xa4, 0x00, 0x20, 0x5b, 0x10, 0xa5, 11 | 0x80, 0xc9, 0x0f, 0xb0, 0xe9, 0xa9, 0x02, 0xcd, 0xeb, 0x1f, 0xf0, 0xe2, 12 | 0xa9, 0x00, 0x85, 0x81, 0x4c, 0x36, 0x10, 0xad, 0xe7, 0x1f, 0xf0, 0x16, 13 | 0xa2, 0x3f, 0xa9, 0x00, 0x95, 0x00, 0xca, 0x10, 0xfb, 0xa2, 0x0b, 0xbd, 14 | 0x70, 0x11, 0x95, 0x83, 0xca, 0x10, 0xf8, 0x4c, 0x83, 0x00, 0x60, 0x20, 15 | 0x7e, 0x12, 0x20, 0xf3, 0x11, 0x20, 0x04, 0x12, 0xa5, 0x93, 0xf0, 0x05, 16 | 0xc6, 0x93, 0x4c, 0xf9, 0x10, 0xa9, 0x20, 0x2d, 0x80, 0x02, 0xf0, 0x07, 17 | 0xa9, 0x02, 0x2d, 0x82, 0x02, 0xd0, 0x0c, 0xa6, 0x81, 0xe8, 0xec, 0xea, 18 | 0x1f, 0xf0, 0x43, 0xe6, 0x81, 0xd0, 0x0d, 0xa9, 0x10, 0x2d, 0x80, 0x02, 19 | 0xd0, 0x0c, 0xa6, 0x81, 0xf0, 0x1a, 0xc6, 0x81, 0xa9, 0x07, 0x85, 0x93, 20 | 0xd0, 0x43, 0xa9, 0x40, 0x2d, 0x80, 0x02, 0xd0, 0x1e, 0x85, 0x81, 0xae, 21 | 0xe8, 0x1f, 0xf0, 0x17, 0xa9, 0x10, 0xd0, 0x4a, 0xae, 0xe8, 0x1f, 0xf0, 22 | 0x0e, 0xa6, 0x82, 0xca, 0x86, 0x81, 0xae, 0xe8, 0x1f, 0xf0, 0x04, 0xa9, 23 | 0x10, 0xd0, 0x37, 0xa9, 0x80, 0x2d, 0x80, 0x02, 0xd0, 0x17, 0xae, 0xea, 24 | 0x1f, 0xca, 0x86, 0x81, 0xae, 0xe8, 0x1f, 0xec, 0xe9, 0x1f, 0xf0, 0x09, 25 | 0xa9, 0x00, 0x85, 0x81, 0xa9, 0x20, 0x4c, 0x12, 0x11, 0x20, 0x4e, 0x12, 26 | 0x20, 0x30, 0x12, 0x24, 0x0c, 0x30, 0x03, 0x4c, 0x10, 0x11, 0xa9, 0x01, 27 | 0x2d, 0x82, 0x02, 0xf0, 0x03, 0x4c, 0x77, 0x10, 0xa5, 0x81, 0x85, 0x80, 28 | 0x60, 0xa9, 0x03, 0x85, 0x04, 0x85, 0x05, 0xa9, 0x70, 0x85, 0x0d, 0xa9, 29 | 0x31, 0x85, 0x0a, 0xa9, 0xb0, 0x85, 0x84, 0xa9, 0x01, 0x85, 0x93, 0xa5, 30 | 0x81, 0xcd, 0xea, 0x1f, 0x90, 0x04, 0xa9, 0x00, 0x85, 0x81, 0x60, 0xa0, 31 | 0x0a, 0xb9, 0x45, 0x11, 0x99, 0x83, 0x00, 0x88, 0x10, 0xf7, 0x4c, 0x83, 32 | 0x00, 0xa2, 0x00, 0xa0, 0x00, 0x88, 0xd0, 0xfd, 0xca, 0xd0, 0xfa, 0x60, 33 | 0xa0, 0x76, 0xb9, 0x7c, 0x11, 0x99, 0x83, 0x00, 0x88, 0x10, 0xf7, 0xa9, 34 | 0x32, 0x85, 0x0a, 0xa9, 0xd2, 0x85, 0x09, 0x85, 0x07, 0xa9, 0x0a, 0x85, 35 | 0x06, 0xa9, 0x00, 0x85, 0x0d, 0x85, 0x0f, 0x60, 0xa9, 0x30, 0x8d, 0xe6, 36 | 0x1f, 0x85, 0x02, 0x85, 0x02, 0x6c, 0xfc, 0xff, 0xf0, 0x00, 0x18, 0x04, 37 | 0x12, 0xba, 0x90, 0x40, 0x30, 0x00, 0x38, 0x44, 0x10, 0x38, 0x10, 0x44, 38 | 0x38, 0x00, 0x30, 0x40, 0x90, 0xba, 0x12, 0x04, 0x18, 0x00, 0x00, 0x44, 39 | 0x92, 0xba, 0x92, 0x44, 0x00, 0x8e, 0xe6, 0x1f, 0xa9, 0x0e, 0x85, 0x02, 40 | 0x85, 0x00, 0x4a, 0xd0, 0xf9, 0xa2, 0x25, 0x20, 0xf4, 0x00, 0x86, 0x01, 41 | 0xa2, 0x20, 0x20, 0xf4, 0x00, 0xe6, 0x83, 0xa5, 0x83, 0x0a, 0xa2, 0x18, 42 | 0xc9, 0x18, 0xb0, 0x03, 0x29, 0x18, 0xaa, 0x86, 0xd1, 0xa2, 0x8b, 0xa0, 43 | 0x07, 0xb5, 0x00, 0x85, 0x02, 0x85, 0x0e, 0x88, 0x10, 0xf9, 0xca, 0xe0, 44 | 0x83, 0xd0, 0xf0, 0xa2, 0x91, 0x20, 0xf4, 0x00, 0xa9, 0x02, 0x85, 0x01, 45 | 0xa2, 0x1e, 0x20, 0xf4, 0x00, 0xad, 0x00, 0x10, 0xc9, 0xd8, 0xd0, 0xb4, 46 | 0x60, 0x85, 0x02, 0xca, 0xd0, 0xfb, 0x60, 0xa9, 0x0e, 0x85, 0x02, 0x85, 47 | 0x00, 0x4a, 0xd0, 0xf9, 0xe6, 0x83, 0xa9, 0x44, 0x8d, 0x96, 0x02, 0x60, 48 | 0xa2, 0x00, 0xa5, 0x83, 0x4a, 0xa9, 0x00, 0x90, 0x02, 0xa9, 0x03, 0x20, 49 | 0x3b, 0x12, 0xe8, 0xa9, 0x30, 0x20, 0x3b, 0x12, 0xa2, 0x04, 0xa9, 0x52, 50 | 0x20, 0x3b, 0x12, 0x85, 0x02, 0x85, 0x2a, 0x85, 0x02, 0x85, 0x2b, 0xa9, 51 | 0xc0, 0x85, 0x20, 0xa9, 0x80, 0x85, 0x21, 0x60, 0xa9, 0x35, 0x8d, 0x96, 52 | 0x02, 0xad, 0x84, 0x02, 0xd0, 0xfb, 0x60, 0x38, 0x85, 0x02, 0xe9, 0x0f, 53 | 0xb0, 0xfc, 0x49, 0x07, 0x0a, 0x0a, 0x0a, 0x0a, 0x95, 0x20, 0x9d, 0x10, 54 | 0x00, 0x60, 0xa2, 0xf4, 0xad, 0x84, 0x02, 0xd0, 0xfb, 0x85, 0x02, 0x85, 55 | 0x01, 0x8e, 0x96, 0x02, 0xa9, 0xb0, 0x85, 0x09, 0x85, 0x02, 0x85, 0x02, 56 | 0x85, 0x02, 0xa2, 0x00, 0xa5, 0x83, 0x4a, 0x90, 0x02, 0xa2, 0x03, 0x4c, 57 | 0x07, 0x10, 0xa2, 0x02, 0xad, 0x84, 0x02, 0xd0, 0xfb, 0x85, 0x02, 0x86, 58 | 0x01, 0x60, 0xa2, 0x0e, 0xa9, 0xd2, 0x95, 0x84, 0xca, 0xd0, 0xfb, 0xa9, 59 | 0x44, 0xa6, 0x81, 0x95, 0x85, 0x60, 0x4c, 0x07, 0x10 60 | }; 61 | -------------------------------------------------------------------------------- /source/STM32firmware/PlusCart/Inc/firmware_pal60_rom.h: -------------------------------------------------------------------------------- 1 | // see firmware_ntsc_rom.h for instructions 2 | 3 | unsigned const char firmware_pal60_rom[]__attribute__((section(".flash0"))) = { 4 | 5 | 0xd8, 0x8d, 0xf4, 0xff, 0x4c, 0x72, 0x12, 0x9d, 0xf5, 0xff, 0xd8, 0xa9, 6 | 0x00, 0xaa, 0xca, 0x9a, 0xba, 0x48, 0xd0, 0xfc, 0x8d, 0x80, 0x02, 0x8d, 7 | 0x81, 0x02, 0x8d, 0x82, 0x02, 0x8d, 0x83, 0x02, 0xad, 0xf4, 0x1f, 0x20, 8 | 0x37, 0x11, 0x20, 0x50, 0x11, 0xa2, 0xff, 0x20, 0xa4, 0x00, 0x20, 0x5b, 9 | 0x10, 0xad, 0x80, 0x02, 0x10, 0xfb, 0x20, 0x15, 0x11, 0x20, 0x77, 0x10, 10 | 0x20, 0x50, 0x11, 0xa6, 0x80, 0x20, 0xa4, 0x00, 0x20, 0x5b, 0x10, 0xa5, 11 | 0x80, 0xc9, 0x0f, 0xb0, 0xe9, 0xa9, 0x02, 0xcd, 0xeb, 0x1f, 0xf0, 0xe2, 12 | 0xa9, 0x00, 0x85, 0x81, 0x4c, 0x36, 0x10, 0xad, 0xe7, 0x1f, 0xf0, 0x16, 13 | 0xa2, 0x3f, 0xa9, 0x00, 0x95, 0x00, 0xca, 0x10, 0xfb, 0xa2, 0x0b, 0xbd, 14 | 0x70, 0x11, 0x95, 0x83, 0xca, 0x10, 0xf8, 0x4c, 0x83, 0x00, 0x60, 0x20, 15 | 0x7e, 0x12, 0x20, 0xf3, 0x11, 0x20, 0x04, 0x12, 0xa5, 0x93, 0xf0, 0x05, 16 | 0xc6, 0x93, 0x4c, 0xf9, 0x10, 0xa9, 0x20, 0x2d, 0x80, 0x02, 0xf0, 0x07, 17 | 0xa9, 0x02, 0x2d, 0x82, 0x02, 0xd0, 0x0c, 0xa6, 0x81, 0xe8, 0xec, 0xea, 18 | 0x1f, 0xf0, 0x43, 0xe6, 0x81, 0xd0, 0x0d, 0xa9, 0x10, 0x2d, 0x80, 0x02, 19 | 0xd0, 0x0c, 0xa6, 0x81, 0xf0, 0x1a, 0xc6, 0x81, 0xa9, 0x07, 0x85, 0x93, 20 | 0xd0, 0x43, 0xa9, 0x40, 0x2d, 0x80, 0x02, 0xd0, 0x1e, 0x85, 0x81, 0xae, 21 | 0xe8, 0x1f, 0xf0, 0x17, 0xa9, 0x10, 0xd0, 0x4a, 0xae, 0xe8, 0x1f, 0xf0, 22 | 0x0e, 0xa6, 0x82, 0xca, 0x86, 0x81, 0xae, 0xe8, 0x1f, 0xf0, 0x04, 0xa9, 23 | 0x10, 0xd0, 0x37, 0xa9, 0x80, 0x2d, 0x80, 0x02, 0xd0, 0x17, 0xae, 0xea, 24 | 0x1f, 0xca, 0x86, 0x81, 0xae, 0xe8, 0x1f, 0xec, 0xe9, 0x1f, 0xf0, 0x09, 25 | 0xa9, 0x00, 0x85, 0x81, 0xa9, 0x20, 0x4c, 0x12, 0x11, 0x20, 0x4e, 0x12, 26 | 0x20, 0x30, 0x12, 0x24, 0x0c, 0x30, 0x03, 0x4c, 0x10, 0x11, 0xa9, 0x01, 27 | 0x2d, 0x82, 0x02, 0xf0, 0x03, 0x4c, 0x77, 0x10, 0xa5, 0x81, 0x85, 0x80, 28 | 0x60, 0xa9, 0x03, 0x85, 0x04, 0x85, 0x05, 0xa9, 0x70, 0x85, 0x0d, 0xa9, 29 | 0x31, 0x85, 0x0a, 0xa9, 0xb0, 0x85, 0x84, 0xa9, 0x01, 0x85, 0x93, 0xa5, 30 | 0x81, 0xcd, 0xea, 0x1f, 0x90, 0x04, 0xa9, 0x00, 0x85, 0x81, 0x60, 0xa0, 31 | 0x0a, 0xb9, 0x45, 0x11, 0x99, 0x83, 0x00, 0x88, 0x10, 0xf7, 0x4c, 0x83, 32 | 0x00, 0xa2, 0x00, 0xa0, 0x00, 0x88, 0xd0, 0xfd, 0xca, 0xd0, 0xfa, 0x60, 33 | 0xa0, 0x76, 0xb9, 0x7c, 0x11, 0x99, 0x83, 0x00, 0x88, 0x10, 0xf7, 0xa9, 34 | 0x32, 0x85, 0x0a, 0xa9, 0xd2, 0x85, 0x09, 0x85, 0x07, 0xa9, 0x0a, 0x85, 35 | 0x06, 0xa9, 0x00, 0x85, 0x0d, 0x85, 0x0f, 0x60, 0xa9, 0x30, 0x8d, 0xe6, 36 | 0x1f, 0x85, 0x02, 0x85, 0x02, 0x6c, 0xfc, 0xff, 0xf0, 0x00, 0x18, 0x04, 37 | 0x12, 0xba, 0x90, 0x40, 0x30, 0x00, 0x38, 0x44, 0x10, 0x38, 0x10, 0x44, 38 | 0x38, 0x00, 0x30, 0x40, 0x90, 0xba, 0x12, 0x04, 0x18, 0x00, 0x00, 0x44, 39 | 0x92, 0xba, 0x92, 0x44, 0x00, 0x8e, 0xe6, 0x1f, 0xa9, 0x0e, 0x85, 0x02, 40 | 0x85, 0x00, 0x4a, 0xd0, 0xf9, 0xa2, 0x25, 0x20, 0xf4, 0x00, 0x86, 0x01, 41 | 0xa2, 0x16, 0x20, 0xf4, 0x00, 0xe6, 0x83, 0xa5, 0x83, 0x0a, 0xa2, 0x18, 42 | 0xc9, 0x18, 0xb0, 0x03, 0x29, 0x18, 0xaa, 0x86, 0xd1, 0xa2, 0x8b, 0xa0, 43 | 0x06, 0xb5, 0x00, 0x85, 0x02, 0x85, 0x0e, 0x88, 0x10, 0xf9, 0xca, 0xe0, 44 | 0x83, 0xd0, 0xf0, 0xa2, 0x71, 0x20, 0xf4, 0x00, 0xa9, 0x02, 0x85, 0x01, 45 | 0xa2, 0x1e, 0x20, 0xf4, 0x00, 0xad, 0x00, 0x10, 0xc9, 0xd8, 0xd0, 0xb4, 46 | 0x60, 0x85, 0x02, 0xca, 0xd0, 0xfb, 0x60, 0xa9, 0x0e, 0x85, 0x02, 0x85, 47 | 0x00, 0x4a, 0xd0, 0xf9, 0xe6, 0x83, 0xa9, 0x24, 0x8d, 0x96, 0x02, 0x60, 48 | 0xa2, 0x00, 0xa5, 0x83, 0x4a, 0xa9, 0x00, 0x90, 0x02, 0xa9, 0x03, 0x20, 49 | 0x3b, 0x12, 0xe8, 0xa9, 0x30, 0x20, 0x3b, 0x12, 0xa2, 0x04, 0xa9, 0x52, 50 | 0x20, 0x3b, 0x12, 0x85, 0x02, 0x85, 0x2a, 0x85, 0x02, 0x85, 0x2b, 0xa9, 51 | 0xc0, 0x85, 0x20, 0xa9, 0x80, 0x85, 0x21, 0x60, 0xa9, 0x1a, 0x8d, 0x96, 52 | 0x02, 0xad, 0x84, 0x02, 0xd0, 0xfb, 0x60, 0x38, 0x85, 0x02, 0xe9, 0x0f, 53 | 0xb0, 0xfc, 0x49, 0x07, 0x0a, 0x0a, 0x0a, 0x0a, 0x95, 0x20, 0x9d, 0x10, 54 | 0x00, 0x60, 0xa2, 0xf4, 0xad, 0x84, 0x02, 0xd0, 0xfb, 0x85, 0x02, 0x85, 55 | 0x01, 0x8e, 0x96, 0x02, 0xa9, 0xb0, 0x85, 0x09, 0x85, 0x02, 0x85, 0x02, 56 | 0x85, 0x02, 0xa2, 0x00, 0xa5, 0x83, 0x4a, 0x90, 0x02, 0xa2, 0x03, 0x4c, 57 | 0x07, 0x10, 0xa2, 0x02, 0xad, 0x84, 0x02, 0xd0, 0xfb, 0x85, 0x02, 0x86, 58 | 0x01, 0x60, 0xa2, 0x0e, 0xa9, 0xd2, 0x95, 0x84, 0xca, 0xd0, 0xfb, 0xa9, 59 | 0x44, 0xa6, 0x81, 0x95, 0x85, 0x60, 0x4c, 0x07, 0x10 60 | }; 61 | -------------------------------------------------------------------------------- /source/STM32firmware/PlusCart/Inc/firmware_uno_pal_rom.h: -------------------------------------------------------------------------------- 1 | // see firmware_ntsc_rom.h for instructions 2 | 3 | unsigned const char firmware_pal_rom[]__attribute__((section(".flash0"))) = { 4 | 5 | 0xd8, 0x8d, 0xf4, 0xff, 0x4c, 0x72, 0x12, 0x9d, 0xf5, 0xff, 0xd8, 0xa9, 6 | 0x00, 0xaa, 0xca, 0x9a, 0xba, 0x48, 0xd0, 0xfc, 0x8d, 0x80, 0x02, 0x8d, 7 | 0x81, 0x02, 0x8d, 0x82, 0x02, 0x8d, 0x83, 0x02, 0xad, 0xf4, 0x1f, 0x20, 8 | 0x37, 0x11, 0x20, 0x50, 0x11, 0xa2, 0xff, 0x20, 0xa4, 0x00, 0x20, 0x5b, 9 | 0x10, 0xad, 0x80, 0x02, 0x10, 0xfb, 0x20, 0x15, 0x11, 0x20, 0x77, 0x10, 10 | 0x20, 0x50, 0x11, 0xa6, 0x80, 0x20, 0xa4, 0x00, 0x20, 0x5b, 0x10, 0xa5, 11 | 0x80, 0xc9, 0x0f, 0xb0, 0xe9, 0xa9, 0x02, 0xcd, 0xeb, 0x1f, 0xf0, 0xe2, 12 | 0xa9, 0x00, 0x85, 0x81, 0x4c, 0x36, 0x10, 0xad, 0xe7, 0x1f, 0xf0, 0x16, 13 | 0xa2, 0x3f, 0xa9, 0x00, 0x95, 0x00, 0xca, 0x10, 0xfb, 0xa2, 0x0b, 0xbd, 14 | 0x70, 0x11, 0x95, 0x83, 0xca, 0x10, 0xf8, 0x4c, 0x83, 0x00, 0x60, 0x20, 15 | 0x7e, 0x12, 0x20, 0xf3, 0x11, 0x20, 0x04, 0x12, 0xa5, 0x93, 0xf0, 0x05, 16 | 0xc6, 0x93, 0x4c, 0xf9, 0x10, 0xa9, 0x20, 0x2d, 0x80, 0x02, 0xf0, 0x07, 17 | 0xa9, 0x02, 0x2d, 0x82, 0x02, 0xd0, 0x0c, 0xa6, 0x81, 0xe8, 0xec, 0xea, 18 | 0x1f, 0xf0, 0x43, 0xe6, 0x81, 0xd0, 0x0d, 0xa9, 0x10, 0x2d, 0x80, 0x02, 19 | 0xd0, 0x0c, 0xa6, 0x81, 0xf0, 0x1a, 0xc6, 0x81, 0xa9, 0x07, 0x85, 0x93, 20 | 0xd0, 0x43, 0xa9, 0x40, 0x2d, 0x80, 0x02, 0xd0, 0x1e, 0x85, 0x81, 0xae, 21 | 0xe8, 0x1f, 0xf0, 0x17, 0xa9, 0x10, 0xd0, 0x4a, 0xae, 0xe8, 0x1f, 0xf0, 22 | 0x0e, 0xa6, 0x82, 0xca, 0x86, 0x81, 0xae, 0xe8, 0x1f, 0xf0, 0x04, 0xa9, 23 | 0x10, 0xd0, 0x37, 0xa9, 0x80, 0x2d, 0x80, 0x02, 0xd0, 0x17, 0xae, 0xea, 24 | 0x1f, 0xca, 0x86, 0x81, 0xae, 0xe8, 0x1f, 0xec, 0xe9, 0x1f, 0xf0, 0x09, 25 | 0xa9, 0x00, 0x85, 0x81, 0xa9, 0x20, 0x4c, 0x12, 0x11, 0x20, 0x4e, 0x12, 26 | 0x20, 0x30, 0x12, 0x24, 0x0c, 0x30, 0x03, 0x4c, 0x10, 0x11, 0xa9, 0x01, 27 | 0x2d, 0x82, 0x02, 0xf0, 0x03, 0x4c, 0x77, 0x10, 0xa5, 0x81, 0x85, 0x80, 28 | 0x60, 0xa9, 0x03, 0x85, 0x04, 0x85, 0x05, 0xa9, 0x70, 0x85, 0x0d, 0xa9, 29 | 0x31, 0x85, 0x0a, 0xa9, 0xb0, 0x85, 0x84, 0xa9, 0x01, 0x85, 0x93, 0xa5, 30 | 0x81, 0xcd, 0xea, 0x1f, 0x90, 0x04, 0xa9, 0x00, 0x85, 0x81, 0x60, 0xa0, 31 | 0x0a, 0xb9, 0x45, 0x11, 0x99, 0x83, 0x00, 0x88, 0x10, 0xf7, 0x4c, 0x83, 32 | 0x00, 0xa2, 0x00, 0xa0, 0x00, 0x88, 0xd0, 0xfd, 0xca, 0xd0, 0xfa, 0x60, 33 | 0xa0, 0x76, 0xb9, 0x7c, 0x11, 0x99, 0x83, 0x00, 0x88, 0x10, 0xf7, 0xa9, 34 | 0x32, 0x85, 0x0a, 0xa9, 0xd2, 0x85, 0x09, 0x85, 0x07, 0xa9, 0x0a, 0x85, 35 | 0x06, 0xa9, 0x00, 0x85, 0x0d, 0x85, 0x0f, 0x60, 0xa9, 0x30, 0x8d, 0xe6, 36 | 0x1f, 0x85, 0x02, 0x85, 0x02, 0x6c, 0xfc, 0xff, 0xf0, 0x00, 0x00, 0x00, 37 | 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x3c, 0x18, 0x00, 38 | 0x00, 0x00, 0x00, 0x4c, 0x2a, 0x6a, 0x4a, 0x2c, 0x00, 0x00, 0xcc, 0x2a, 39 | 0x29, 0x49, 0x89, 0x8a, 0x6c, 0x8e, 0xe6, 0x1f, 0xa9, 0x0e, 0x85, 0x02, 40 | 0x85, 0x00, 0x4a, 0xd0, 0xf9, 0xa2, 0x25, 0x20, 0xf4, 0x00, 0x86, 0x01, 41 | 0xa2, 0x20, 0x20, 0xf4, 0x00, 0xe6, 0x83, 0xa5, 0x83, 0x0a, 0xa2, 0x18, 42 | 0xc9, 0x18, 0xb0, 0x03, 0x29, 0x18, 0xaa, 0x86, 0xd1, 0xa2, 0x8b, 0xa0, 43 | 0x07, 0xb5, 0x00, 0x85, 0x02, 0x85, 0x0e, 0x88, 0x10, 0xf9, 0xca, 0xe0, 44 | 0x83, 0xd0, 0xf0, 0xa2, 0x91, 0x20, 0xf4, 0x00, 0xa9, 0x02, 0x85, 0x01, 45 | 0xa2, 0x1e, 0x20, 0xf4, 0x00, 0xad, 0x00, 0x10, 0xc9, 0xd8, 0xd0, 0xb4, 46 | 0x60, 0x85, 0x02, 0xca, 0xd0, 0xfb, 0x60, 0xa9, 0x0e, 0x85, 0x02, 0x85, 47 | 0x00, 0x4a, 0xd0, 0xf9, 0xe6, 0x83, 0xa9, 0x44, 0x8d, 0x96, 0x02, 0x60, 48 | 0xa2, 0x00, 0xa5, 0x83, 0x4a, 0xa9, 0x00, 0x90, 0x02, 0xa9, 0x03, 0x20, 49 | 0x3b, 0x12, 0xe8, 0xa9, 0x30, 0x20, 0x3b, 0x12, 0xa2, 0x04, 0xa9, 0x52, 50 | 0x20, 0x3b, 0x12, 0x85, 0x02, 0x85, 0x2a, 0x85, 0x02, 0x85, 0x2b, 0xa9, 51 | 0xc0, 0x85, 0x20, 0xa9, 0x80, 0x85, 0x21, 0x60, 0xa9, 0x35, 0x8d, 0x96, 52 | 0x02, 0xad, 0x84, 0x02, 0xd0, 0xfb, 0x60, 0x38, 0x85, 0x02, 0xe9, 0x0f, 53 | 0xb0, 0xfc, 0x49, 0x07, 0x0a, 0x0a, 0x0a, 0x0a, 0x95, 0x20, 0x9d, 0x10, 54 | 0x00, 0x60, 0xa2, 0xf4, 0xad, 0x84, 0x02, 0xd0, 0xfb, 0x85, 0x02, 0x85, 55 | 0x01, 0x8e, 0x96, 0x02, 0xa9, 0xb0, 0x85, 0x09, 0x85, 0x02, 0x85, 0x02, 56 | 0x85, 0x02, 0xa2, 0x00, 0xa5, 0x83, 0x4a, 0x90, 0x02, 0xa2, 0x03, 0x4c, 57 | 0x07, 0x10, 0xa2, 0x02, 0xad, 0x84, 0x02, 0xd0, 0xfb, 0x85, 0x02, 0x86, 58 | 0x01, 0x60, 0xa2, 0x0e, 0xa9, 0xd2, 0x95, 0x84, 0xca, 0xd0, 0xfb, 0xa9, 59 | 0x44, 0xa6, 0x81, 0x95, 0x85, 0x60, 0x4c, 0x07, 0x10 60 | }; 61 | -------------------------------------------------------------------------------- /source/STM32firmware/PlusCart/Inc/firmware_uno_pal60_rom.h: -------------------------------------------------------------------------------- 1 | // see firmware_ntsc_rom.h for instructions 2 | 3 | unsigned const char firmware_pal60_rom[]__attribute__((section(".flash0"))) = { 4 | 5 | 0xd8, 0x8d, 0xf4, 0xff, 0x4c, 0x72, 0x12, 0x9d, 0xf5, 0xff, 0xd8, 0xa9, 6 | 0x00, 0xaa, 0xca, 0x9a, 0xba, 0x48, 0xd0, 0xfc, 0x8d, 0x80, 0x02, 0x8d, 7 | 0x81, 0x02, 0x8d, 0x82, 0x02, 0x8d, 0x83, 0x02, 0xad, 0xf4, 0x1f, 0x20, 8 | 0x37, 0x11, 0x20, 0x50, 0x11, 0xa2, 0xff, 0x20, 0xa4, 0x00, 0x20, 0x5b, 9 | 0x10, 0xad, 0x80, 0x02, 0x10, 0xfb, 0x20, 0x15, 0x11, 0x20, 0x77, 0x10, 10 | 0x20, 0x50, 0x11, 0xa6, 0x80, 0x20, 0xa4, 0x00, 0x20, 0x5b, 0x10, 0xa5, 11 | 0x80, 0xc9, 0x0f, 0xb0, 0xe9, 0xa9, 0x02, 0xcd, 0xeb, 0x1f, 0xf0, 0xe2, 12 | 0xa9, 0x00, 0x85, 0x81, 0x4c, 0x36, 0x10, 0xad, 0xe7, 0x1f, 0xf0, 0x16, 13 | 0xa2, 0x3f, 0xa9, 0x00, 0x95, 0x00, 0xca, 0x10, 0xfb, 0xa2, 0x0b, 0xbd, 14 | 0x70, 0x11, 0x95, 0x83, 0xca, 0x10, 0xf8, 0x4c, 0x83, 0x00, 0x60, 0x20, 15 | 0x7e, 0x12, 0x20, 0xf3, 0x11, 0x20, 0x04, 0x12, 0xa5, 0x93, 0xf0, 0x05, 16 | 0xc6, 0x93, 0x4c, 0xf9, 0x10, 0xa9, 0x20, 0x2d, 0x80, 0x02, 0xf0, 0x07, 17 | 0xa9, 0x02, 0x2d, 0x82, 0x02, 0xd0, 0x0c, 0xa6, 0x81, 0xe8, 0xec, 0xea, 18 | 0x1f, 0xf0, 0x43, 0xe6, 0x81, 0xd0, 0x0d, 0xa9, 0x10, 0x2d, 0x80, 0x02, 19 | 0xd0, 0x0c, 0xa6, 0x81, 0xf0, 0x1a, 0xc6, 0x81, 0xa9, 0x07, 0x85, 0x93, 20 | 0xd0, 0x43, 0xa9, 0x40, 0x2d, 0x80, 0x02, 0xd0, 0x1e, 0x85, 0x81, 0xae, 21 | 0xe8, 0x1f, 0xf0, 0x17, 0xa9, 0x10, 0xd0, 0x4a, 0xae, 0xe8, 0x1f, 0xf0, 22 | 0x0e, 0xa6, 0x82, 0xca, 0x86, 0x81, 0xae, 0xe8, 0x1f, 0xf0, 0x04, 0xa9, 23 | 0x10, 0xd0, 0x37, 0xa9, 0x80, 0x2d, 0x80, 0x02, 0xd0, 0x17, 0xae, 0xea, 24 | 0x1f, 0xca, 0x86, 0x81, 0xae, 0xe8, 0x1f, 0xec, 0xe9, 0x1f, 0xf0, 0x09, 25 | 0xa9, 0x00, 0x85, 0x81, 0xa9, 0x20, 0x4c, 0x12, 0x11, 0x20, 0x4e, 0x12, 26 | 0x20, 0x30, 0x12, 0x24, 0x0c, 0x30, 0x03, 0x4c, 0x10, 0x11, 0xa9, 0x01, 27 | 0x2d, 0x82, 0x02, 0xf0, 0x03, 0x4c, 0x77, 0x10, 0xa5, 0x81, 0x85, 0x80, 28 | 0x60, 0xa9, 0x03, 0x85, 0x04, 0x85, 0x05, 0xa9, 0x70, 0x85, 0x0d, 0xa9, 29 | 0x31, 0x85, 0x0a, 0xa9, 0xb0, 0x85, 0x84, 0xa9, 0x01, 0x85, 0x93, 0xa5, 30 | 0x81, 0xcd, 0xea, 0x1f, 0x90, 0x04, 0xa9, 0x00, 0x85, 0x81, 0x60, 0xa0, 31 | 0x0a, 0xb9, 0x45, 0x11, 0x99, 0x83, 0x00, 0x88, 0x10, 0xf7, 0x4c, 0x83, 32 | 0x00, 0xa2, 0x00, 0xa0, 0x00, 0x88, 0xd0, 0xfd, 0xca, 0xd0, 0xfa, 0x60, 33 | 0xa0, 0x76, 0xb9, 0x7c, 0x11, 0x99, 0x83, 0x00, 0x88, 0x10, 0xf7, 0xa9, 34 | 0x32, 0x85, 0x0a, 0xa9, 0xd2, 0x85, 0x09, 0x85, 0x07, 0xa9, 0x0a, 0x85, 35 | 0x06, 0xa9, 0x00, 0x85, 0x0d, 0x85, 0x0f, 0x60, 0xa9, 0x30, 0x8d, 0xe6, 36 | 0x1f, 0x85, 0x02, 0x85, 0x02, 0x6c, 0xfc, 0xff, 0xf0, 0x00, 0x00, 0x00, 37 | 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x3c, 0x18, 0x00, 38 | 0x00, 0x00, 0x00, 0x4c, 0x2a, 0x6a, 0x4a, 0x2c, 0x00, 0x00, 0xcc, 0x2a, 39 | 0x29, 0x49, 0x89, 0x8a, 0x6c, 0x8e, 0xe6, 0x1f, 0xa9, 0x0e, 0x85, 0x02, 40 | 0x85, 0x00, 0x4a, 0xd0, 0xf9, 0xa2, 0x25, 0x20, 0xf4, 0x00, 0x86, 0x01, 41 | 0xa2, 0x16, 0x20, 0xf4, 0x00, 0xe6, 0x83, 0xa5, 0x83, 0x0a, 0xa2, 0x18, 42 | 0xc9, 0x18, 0xb0, 0x03, 0x29, 0x18, 0xaa, 0x86, 0xd1, 0xa2, 0x8b, 0xa0, 43 | 0x06, 0xb5, 0x00, 0x85, 0x02, 0x85, 0x0e, 0x88, 0x10, 0xf9, 0xca, 0xe0, 44 | 0x83, 0xd0, 0xf0, 0xa2, 0x71, 0x20, 0xf4, 0x00, 0xa9, 0x02, 0x85, 0x01, 45 | 0xa2, 0x1e, 0x20, 0xf4, 0x00, 0xad, 0x00, 0x10, 0xc9, 0xd8, 0xd0, 0xb4, 46 | 0x60, 0x85, 0x02, 0xca, 0xd0, 0xfb, 0x60, 0xa9, 0x0e, 0x85, 0x02, 0x85, 47 | 0x00, 0x4a, 0xd0, 0xf9, 0xe6, 0x83, 0xa9, 0x24, 0x8d, 0x96, 0x02, 0x60, 48 | 0xa2, 0x00, 0xa5, 0x83, 0x4a, 0xa9, 0x00, 0x90, 0x02, 0xa9, 0x03, 0x20, 49 | 0x3b, 0x12, 0xe8, 0xa9, 0x30, 0x20, 0x3b, 0x12, 0xa2, 0x04, 0xa9, 0x52, 50 | 0x20, 0x3b, 0x12, 0x85, 0x02, 0x85, 0x2a, 0x85, 0x02, 0x85, 0x2b, 0xa9, 51 | 0xc0, 0x85, 0x20, 0xa9, 0x80, 0x85, 0x21, 0x60, 0xa9, 0x1a, 0x8d, 0x96, 52 | 0x02, 0xad, 0x84, 0x02, 0xd0, 0xfb, 0x60, 0x38, 0x85, 0x02, 0xe9, 0x0f, 53 | 0xb0, 0xfc, 0x49, 0x07, 0x0a, 0x0a, 0x0a, 0x0a, 0x95, 0x20, 0x9d, 0x10, 54 | 0x00, 0x60, 0xa2, 0xf4, 0xad, 0x84, 0x02, 0xd0, 0xfb, 0x85, 0x02, 0x85, 55 | 0x01, 0x8e, 0x96, 0x02, 0xa9, 0xb0, 0x85, 0x09, 0x85, 0x02, 0x85, 0x02, 56 | 0x85, 0x02, 0xa2, 0x00, 0xa5, 0x83, 0x4a, 0x90, 0x02, 0xa2, 0x03, 0x4c, 57 | 0x07, 0x10, 0xa2, 0x02, 0xad, 0x84, 0x02, 0xd0, 0xfb, 0x85, 0x02, 0x86, 58 | 0x01, 0x60, 0xa2, 0x0e, 0xa9, 0xd2, 0x95, 0x84, 0xca, 0xd0, 0xfb, 0xa9, 59 | 0x44, 0xa6, 0x81, 0x95, 0x85, 0x60, 0x4c, 0x07, 0x10 60 | }; 61 | -------------------------------------------------------------------------------- /source/ElfTests/raycaster/raycaster.c: -------------------------------------------------------------------------------- 1 | #include "vcsLib.h" 2 | #include "assets.h" 3 | #include "overblank.h" 4 | 5 | #define vcsWritePF3(address, data, nextCol) vcsWrite3(address, data); \ 6 | colupf = heights[nextCol] >= start ? colors[nextCol] : colbak; 7 | 8 | 9 | // TODO move to common location 10 | 11 | int elf_main(uint32_t *args) 12 | { 13 | uint8_t but0 = 0xff; 14 | uint8_t joy0 = 0xff; 15 | 16 | // Always reset PC first, cause it's going to be close to the end of the 6507 address space 17 | vcsJmp3(); 18 | // Init TIA 19 | for (int i = 0; i < 0x80; i++) { 20 | vcsLda2(0); 21 | vcsSta3((unsigned char)i); 22 | } 23 | 24 | vcsCopyOverblankToRiotRam(); 25 | vcsStartOverblank(); 26 | 27 | for (int i = 0; i < 40; i++) 28 | { 29 | heights[i] = 100; 30 | colors[i] = (uint8_t)((i << 4) | 0xf); 31 | } 32 | 33 | while (1) 34 | { 35 | overblank(but0, joy0, colors, args[MP_SYSTEM_TYPE]); 36 | 37 | vcsEndOverblank(); 38 | if (0 == (but0 & 0x80)) 39 | { 40 | vcsJmp3(); 41 | vcsNop2n(0xf00); 42 | return 0; 43 | } 44 | 45 | vcsWrite5(CTRLPF, 0); 46 | vcsWrite5(GRP0, 0); 47 | vcsWrite5(GRP1, 0); 48 | vcsWrite5(ENAM0, 0); 49 | vcsWrite5(ENAM1, 0); 50 | vcsWrite5(ENABL, 0); 51 | 52 | vcsWrite5(COLUBK, 0); 53 | vcsWrite5(COLUPF, 0); 54 | 55 | vcsSta3(WSYNC); 56 | vcsSta3(WSYNC); 57 | vcsSta3(WSYNC); 58 | vcsSta3(WSYNC); 59 | 60 | 61 | vcsWrite5(VBLANK, 0); 62 | 63 | vcsLdaForBusStuff2(); 64 | vcsLdxForBusStuff2(); 65 | vcsLdyForBusStuff2(); 66 | 67 | vcsSta3(WSYNC); 68 | vcsSta3(WSYNC); 69 | 70 | for (int i = 0; i < 64; i++) 71 | { 72 | unsigned char colupf; 73 | // First 74 | vcsNop2n(3); 75 | int start = i < 32 ? 32 - i : i - 32; 76 | int colbak = ((start >> 2) & 0x0f); 77 | colbak |= i < 32 ? 0x80 : 0xc0; 78 | vcsWrite3(PF0, 0x55); 79 | vcsWrite3(PF1, 0x49); 80 | vcsWritePF3(PF2, 0x24, 0); 81 | vcsWrite3(COLUPF, colupf); 82 | 83 | vcsJmp3(); 84 | vcsWritePF3(COLUPF, 0, 5); 85 | vcsWritePF3(COLUPF, colupf, 8); 86 | vcsNop2(); 87 | vcsWritePF3(COLUPF, colupf, 11); 88 | vcsWritePF3(COLUPF, colupf, 14); 89 | vcsNop2(); 90 | vcsWritePF3(COLUPF, colupf, 17); 91 | vcsWritePF3(COLUPF, colupf, 20); 92 | vcsNop2(); 93 | vcsWritePF3(COLUPF, colupf, 25); 94 | vcsWrite3(COLUPF, 0); // MASKED 95 | vcsNop2(); 96 | vcsWritePF3(COLUPF, colupf, 28); 97 | vcsWritePF3(COLUPF, colupf, 31); 98 | vcsNop2(); 99 | vcsWritePF3(COLUPF, colupf, 34); 100 | vcsWritePF3(COLUPF, colupf, 37); 101 | vcsNop2(); 102 | vcsWrite3(COLUPF, colupf); 103 | vcsSta3(WSYNC); 104 | 105 | // Second 106 | vcsWrite3(PF0, 0xaa); 107 | vcsWrite3(PF1, 0x24); 108 | vcsWritePF3(PF2, 0x49, 1); 109 | vcsWritePF3(COLUPF, colupf, 3); 110 | vcsJmp3(); 111 | vcsJmp3(); 112 | vcsJmp3(); 113 | vcsNop2(); 114 | vcsWritePF3(COLUPF, colupf, 6); 115 | vcsWritePF3(COLUPF, colupf, 9); 116 | vcsNop2(); 117 | vcsWritePF3(COLUPF, colupf, 12); 118 | vcsWritePF3(COLUPF, colupf, 15); 119 | vcsNop2(); 120 | vcsWritePF3(COLUPF, colupf, 18); 121 | vcsWritePF3(COLUPF, colupf, 21); 122 | vcsNop2(); 123 | vcsWritePF3(COLUPF, colupf, 23); 124 | vcsWritePF3(COLUPF, colupf, 26); 125 | vcsWritePF3(COLUPF, colupf, 29); 126 | vcsNop2(); 127 | vcsWritePF3(COLUPF, colupf, 32); 128 | vcsWritePF3(COLUPF, colupf, 35); 129 | vcsNop2(); 130 | vcsWritePF3(COLUPF, colupf, 38); 131 | vcsWrite3(COLUPF, colupf); // 38 132 | vcsSta3(WSYNC); 133 | 134 | // Third 135 | vcsWrite3(PF0, 0x44); 136 | vcsWrite3(PF1, 0x92); 137 | vcsWritePF3(PF2, 0x92, 2); 138 | vcsWritePF3(COLUPF, colupf, 4); 139 | vcsJmp3(); 140 | vcsJmp3(); 141 | vcsJmp3(); 142 | vcsJmp3(); 143 | vcsWritePF3(COLUPF, colupf, 7); 144 | vcsWritePF3(COLUPF, colupf, 10); 145 | vcsNop2(); 146 | vcsWritePF3(COLUPF, colupf, 13); 147 | vcsWritePF3(COLUPF, colupf, 16); 148 | vcsNop2(); 149 | vcsWritePF3(COLUPF, colupf, 19); 150 | vcsWritePF3(COLUPF, colupf, 22); 151 | vcsNop2(); 152 | vcsWritePF3(COLUPF, colupf, 24); 153 | vcsWritePF3(COLUPF, colupf, 27); 154 | vcsWritePF3(COLUPF, colupf, 30); 155 | vcsNop2(); 156 | vcsWritePF3(COLUPF, colupf, 33); 157 | vcsWritePF3(COLUPF, colupf, 36); 158 | vcsNop2(); 159 | vcsWritePF3(COLUPF, colupf, 39); 160 | vcsWrite3(COLUPF, colupf); // 39 161 | 162 | vcsSta3(PF0); // Waste 3 cycles with as much time as possible before next bus service is needed 163 | } 164 | 165 | vcsWrite5(VBLANK, 2); 166 | but0 = vcsRead4(INPT4); 167 | joy0 = vcsRead4(SWCHA); 168 | vcsStartOverblank(); 169 | } 170 | } 171 | -------------------------------------------------------------------------------- /source/STM32firmware/PlusCart/Inc/esp8266.h: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * See: esp8266.c 4 | * 5 | */ 6 | 7 | #include "global.h" 8 | 9 | #ifndef ESP8266_H 10 | #define ESP8266_H 11 | 12 | #ifdef __cplusplus 13 | extern "C" { 14 | #endif 15 | 16 | #define CURRENT_ESP8266_FIRMWARE "1.7.5.0" 17 | 18 | /** API connect/request **/ 19 | #define API_ATCMD_1 "AT+CIPSTART=\"TCP\",\"" 20 | #define API_ATCMD_1a "AT+CIPSTART=%c,\"TCP\",\"" 21 | #define API_ATCMD_1b "\",80\r\n" 22 | #define API_ATCMD_2 "AT+CIPSEND\r\n" 23 | #define API_ATCMD_3 "GET /api.php?p=" 24 | #define API_ATCMD_4 " HTTP/1.0\r\nHost: " 25 | #define API_ATCMD_5 "\r\nPlusStore-ID: v" VERSION " " 26 | #define API_ATCMD_6 " " DEVICE_TYPE "\r\nClient-Conf: " 27 | #define API_ATCMD_7 "\r\nConnection: keep-alive\r\n" 28 | #define API_ATCMD_8 "Range: bytes=" 29 | #define API_ATCMD_9 "\r\n" 30 | 31 | /* Hash Values of ESP8266 Response messages */ 32 | #define ESP8266_NO_RESPONSE 5381UL // initial hash value 33 | #define ESP8266_OK 5862591UL // "OK" 34 | #define ESP8266_READY_TO_WRITE_TCP 5861987UL // "> " 35 | #define ESP8266_READY 210726483418UL // "ready" 36 | #define ESP8266_ERROR 210672417103UL // "ERROR" 37 | //#define ESP8266_WIFI_DISCONNECT 8577780109829502590UL 38 | //#define ESP8266_WIFI_CONNECTED 12557760956336869543UL 39 | //#define ESP8266_WIFI_GOT_IP 13849395132461575191UL 40 | //#define ESP8266_BUSY_SENDING 249883165265657893UL // busy s... 41 | //#define ESP8266_BUSY_PROCESSING 249883165265550082UL // busy p... 42 | #define ESP8266_SEND_OK 229439828825865UL // "SEND OK" 43 | #define ESP8266_CONNECT 229419557091567UL // "CONNECT" 44 | #define ESP8266_ALREADY_CONNECTED 8346027424717406042UL // "ALREADY CONNECTED" 45 | #define ESP8266_CLOSED 6952104274271UL // "CLOSED" 46 | #define ESP8266_FAIL 6384029761UL // "FAIL" 47 | #define ESP8266_WPS_SUCCESS 13356836868472365895UL // "wps success,connecting ap ..." 48 | 49 | 50 | #define HAL_UART_TIMEOUT_SEND 180 51 | #define HAL_UART_TIMEOUT_RECEIVE 100 52 | 53 | #define PLUSSTORE_CONNECT_TIMEOUT 10000 54 | #define PLUSSTORE_RESPONSE_START_TIMEOUT 25000 55 | #define PLUSROM_API_CONNECT_TIMEOUT PLUSSTORE_CONNECT_TIMEOUT 56 | 57 | #define MAX_RANGE_SIZE 32768 58 | 59 | extern char esp8266_at_version[15]; 60 | 61 | typedef struct { 62 | uint32_t start; 63 | uint32_t stop; 64 | } http_range; 65 | 66 | 67 | /** Should be written by the user for input from / output to the ESP module **/ 68 | 69 | void esp8266_init(void) __attribute__((section(".flash01"))); 70 | void esp8266_update(void) __attribute__((section(".flash01"))); 71 | 72 | 73 | /** Function prototypes **/ 74 | 75 | int esp8266_file_list(char *, MENU_ENTRY **, int *, uint8_t *, char *); 76 | void check_api_host(void) __attribute__((section(".flash01"))); 77 | 78 | bool esp8266_PlusStore_API_connect(void) __attribute__((section(".flash01"))); 79 | void esp8266_PlusStore_API_prepare_request_header(char *, bool ) __attribute__((section(".flash01"))); 80 | void esp8266_PlusStore_API_end_transmission(void) __attribute__((section(".flash01"))); 81 | 82 | int esp8266_PlusROM_API_connect(unsigned int) __attribute__((section(".flash01"))); 83 | 84 | uint16_t esp8266_skip_http_response_header(void) __attribute__((section(".flash01"))); 85 | 86 | // Check if the module is started (AT) 87 | bool esp8266_is_started(void); 88 | // Restart module (AT+RST) 89 | bool esp8266_reset(bool) __attribute__((section(".flash01"))); 90 | bool esp8266_wifi_list(MENU_ENTRY **, int *); 91 | bool esp8266_wifi_connect(char *, char *); 92 | bool esp8266_wps_connect(void) __attribute__((section(".flash01"))); 93 | 94 | uint32_t esp8266_PlusStore_API_range_request( char *, http_range, uint8_t *) __attribute__((section(".flash01"))); 95 | uint32_t esp8266_PlusStore_API_file_request( uint8_t *, char *, uint32_t, uint32_t ) __attribute__((section(".flash01"))); 96 | 97 | // Is connected to AP (AT+CWJAP?) 98 | bool esp8266_is_connected(void) __attribute__((section(".flash01"))); 99 | 100 | // Disconnect from AP (AT+CWQAP) 101 | void esp8266_disconnect(void) __attribute__((section(".flash01"))); 102 | 103 | // Print a string to the output __attribute__ ((noinline)) ? 104 | void esp8266_print(char *) __attribute__((section(".flash01"))); 105 | 106 | void esp8266_AT_WiFiManager() __attribute__((section(".flash01"))); 107 | 108 | void read_esp8266_at_version(void) __attribute__((section(".flash01"))); 109 | 110 | #ifdef __cplusplus 111 | } 112 | #endif 113 | 114 | #endif /* ESP8266_H */ 115 | -------------------------------------------------------------------------------- /source/STM32firmware/PlusCart/Src/cartridge_emulation_3F.c: -------------------------------------------------------------------------------- 1 | /* 3F (Tigervision) Bankswitching 2 | * ------------------------------ 3 | * Generally 8K ROMs, containing 4 x 2K banks. The last bank is always mapped into 4 | * the upper part of the 4K cartridge ROM space. The bank mapped into the lower part 5 | * of the 4K cartridge ROM space is selected by the lowest two bits written to $003F 6 | * (or any lower address). 7 | * In theory this scheme supports up to 512k ROMs if we use all the bits written to 8 | * $003F - the code below should support up to MAX_CART_ROM_SIZE. 9 | * 10 | * Note - Stella restricts bank switching to only *WRITES* to $0000-$003f. But we 11 | * can't do this here and Miner 2049'er crashes (unless we restrict to $003f only). 12 | * 13 | * From an post by Eckhard Stolberg, it seems the switch would happen on a real cart 14 | * only when the access is followed by an access to an address between $1000 and $1FFF. 15 | * 16 | * 29/3/18 - The emulation below switches on access to $003f only, since the my prior 17 | * attempt at the banking scheme described by Eckhard Stolberg didn't work on a 7800. 18 | * 19 | * Refs: 20 | * http://atariage.com/forums/topic/266245-tigervision-banking-and-low-memory-reads/ 21 | * http://atariage.com/forums/topic/68544-3f-bankswitching/ 22 | */ 23 | 24 | #include 25 | #include 26 | #include "cartridge_emulation.h" 27 | #include "cartridge_setup.h" 28 | #include "cartridge_emulation_3F.h" 29 | #include "cartridge_firmware.h" 30 | 31 | void emulate_3F_cartridge( const char* filename, uint32_t image_size, uint8_t* buffer, MENU_ENTRY *d) 32 | { 33 | /* setup_cartridge_image(); 34 | if (cart_size_bytes > 0x010000) return; 35 | uint8_t* cart_rom = buffer; 36 | */ 37 | cartridge_layout * layout = (cartridge_layout *) malloc( sizeof( cartridge_layout )); 38 | 39 | if (!setup_cartridge_image(filename, image_size, buffer, layout, d, base_type_3F)) return; 40 | 41 | 42 | // uint8_t banks = (uint8_t)(( image_size / 2048 ) - 1); 43 | // uint8_t *bank = layout->banks[banks]; 44 | 45 | int cartPages = (int) image_size/2048; 46 | uint16_t addr, addr_prev = 0, addr_prev2 = 0; 47 | uint8_t data = 0, data_prev = 0; 48 | unsigned char *bankPtr = layout->banks[0]; 49 | unsigned char *fixedPtr = layout->banks[cartPages-1]; 50 | bool joy_status = false; 51 | 52 | if (!reboot_into_cartridge()) return; 53 | __disable_irq(); // Disable interrupts 54 | 55 | while (1) 56 | { 57 | while (((addr = ADDR_IN) != addr_prev) || (addr != addr_prev2)) 58 | { // new more robust test for stable address (seems to be needed for 7800) 59 | addr_prev2 = addr_prev; 60 | addr_prev = addr; 61 | } 62 | // got a stable address 63 | if (addr & 0x1000) 64 | { // A12 high 65 | if (addr & 0x800) 66 | DATA_OUT = fixedPtr[addr&0x7FF]; 67 | else 68 | DATA_OUT = bankPtr[addr&0x7FF]; 69 | SET_DATA_MODE_OUT 70 | // wait for address bus to change 71 | while (ADDR_IN == addr) ; 72 | SET_DATA_MODE_IN 73 | } 74 | else 75 | { // A12 low, read last data on the bus before the address lines change 76 | if (addr == 0x003F) 77 | { // switch bank 78 | while (ADDR_IN == addr) { data_prev = data; data = DATA_IN; } 79 | //int newPage = data_prev % cartPages; //data_prev>>8 80 | bankPtr = layout->banks[data_prev % cartPages]; 81 | } 82 | else if(addr == EXIT_SWCHB_ADDR){ 83 | while (ADDR_IN == addr) { data_prev = data; data = DATA_IN; } 84 | if( !(data_prev & 0x1) && joy_status) 85 | break; 86 | }else if(addr == SWCHA){ 87 | while (ADDR_IN == addr) { data_prev = data; data = DATA_IN; } 88 | joy_status = !(data_prev & 0x80); 89 | } 90 | } 91 | } 92 | 93 | exit_cartridge(addr, addr_prev); 94 | } 95 | 96 | /* Scheme as described by Eckhard Stolberg. Didn't work on my test 7800, so replaced 97 | * by the simpler 3F only scheme above. 98 | while (1) 99 | { 100 | while ((addr = ADDR_IN) != addr_prev) 101 | addr_prev = addr; 102 | // got a stable address 103 | if (!(addr & 0x1000)) 104 | { // A12 low, read last data on the bus before the address lines change 105 | while (ADDR_IN == addr) { data_prev = data; data = DATA_IN; } 106 | data = data_prev; 107 | if (addr <= 0x003F) newPage = data % cartPages; else newPage = -1; 108 | } 109 | else 110 | { // A12 high 111 | if (newPage >=0) { 112 | bankPtr = &cart_rom[newPage*2048]; // switch bank 113 | newPage = -1; 114 | } 115 | if (addr & 0x800) 116 | data = fixedPtr[addr&0x7FF]; 117 | else 118 | data = bankPtr[addr&0x7FF]; 119 | DATA_OUT = data; 120 | SET_DATA_MODE_OUT 121 | // wait for address bus to change 122 | while (ADDR_IN == addr) ; 123 | SET_DATA_MODE_IN 124 | } 125 | } 126 | */ 127 | -------------------------------------------------------------------------------- /source/STM32firmware/PlusCart/Inc/firmware_ntsc_rom.h: -------------------------------------------------------------------------------- 1 | // To generate: 2 | // First build the PlusCart binary in Atari2600ROM folder (either NTSC/PAL/PAL60 variant) 3 | // the required structure size is output on the command line (e.g., "SIZE: 605") 4 | // Then (MacOS) run (with the correct size value)... 5 | // xxd -g1 -i -len 605 PlusCart.bin 6 | // This will output a c-structure, the contents of which can be inserted below... 7 | 8 | unsigned const char firmware_ntsc_rom[]__attribute__((section(".flash0"))) = { 9 | 10 | 0xd8, 0x8d, 0xf4, 0xff, 0x4c, 0x72, 0x12, 0x9d, 0xf5, 0xff, 0xd8, 0xa9, 11 | 0x00, 0xaa, 0xca, 0x9a, 0xba, 0x48, 0xd0, 0xfc, 0x8d, 0x80, 0x02, 0x8d, 12 | 0x81, 0x02, 0x8d, 0x82, 0x02, 0x8d, 0x83, 0x02, 0xad, 0xf4, 0x1f, 0x20, 13 | 0x37, 0x11, 0x20, 0x50, 0x11, 0xa2, 0xff, 0x20, 0xa4, 0x00, 0x20, 0x5b, 14 | 0x10, 0xad, 0x80, 0x02, 0x10, 0xfb, 0x20, 0x15, 0x11, 0x20, 0x77, 0x10, 15 | 0x20, 0x50, 0x11, 0xa6, 0x80, 0x20, 0xa4, 0x00, 0x20, 0x5b, 0x10, 0xa5, 16 | 0x80, 0xc9, 0x0f, 0xb0, 0xe9, 0xa9, 0x02, 0xcd, 0xeb, 0x1f, 0xf0, 0xe2, 17 | 0xa9, 0x00, 0x85, 0x81, 0x4c, 0x36, 0x10, 0xad, 0xe7, 0x1f, 0xf0, 0x16, 18 | 0xa2, 0x3f, 0xa9, 0x00, 0x95, 0x00, 0xca, 0x10, 0xfb, 0xa2, 0x0b, 0xbd, 19 | 0x70, 0x11, 0x95, 0x83, 0xca, 0x10, 0xf8, 0x4c, 0x83, 0x00, 0x60, 0x20, 20 | 0x7e, 0x12, 0x20, 0xf3, 0x11, 0x20, 0x04, 0x12, 0xa5, 0x93, 0xf0, 0x05, 21 | 0xc6, 0x93, 0x4c, 0xf9, 0x10, 0xa9, 0x20, 0x2d, 0x80, 0x02, 0xf0, 0x07, 22 | 0xa9, 0x02, 0x2d, 0x82, 0x02, 0xd0, 0x0c, 0xa6, 0x81, 0xe8, 0xec, 0xea, 23 | 0x1f, 0xf0, 0x43, 0xe6, 0x81, 0xd0, 0x0d, 0xa9, 0x10, 0x2d, 0x80, 0x02, 24 | 0xd0, 0x0c, 0xa6, 0x81, 0xf0, 0x1a, 0xc6, 0x81, 0xa9, 0x07, 0x85, 0x93, 25 | 0xd0, 0x43, 0xa9, 0x40, 0x2d, 0x80, 0x02, 0xd0, 0x1e, 0x85, 0x81, 0xae, 26 | 0xe8, 0x1f, 0xf0, 0x17, 0xa9, 0x10, 0xd0, 0x4a, 0xae, 0xe8, 0x1f, 0xf0, 27 | 0x0e, 0xa6, 0x82, 0xca, 0x86, 0x81, 0xae, 0xe8, 0x1f, 0xf0, 0x04, 0xa9, 28 | 0x10, 0xd0, 0x37, 0xa9, 0x80, 0x2d, 0x80, 0x02, 0xd0, 0x17, 0xae, 0xea, 29 | 0x1f, 0xca, 0x86, 0x81, 0xae, 0xe8, 0x1f, 0xec, 0xe9, 0x1f, 0xf0, 0x09, 30 | 0xa9, 0x00, 0x85, 0x81, 0xa9, 0x20, 0x4c, 0x12, 0x11, 0x20, 0x4e, 0x12, 31 | 0x20, 0x30, 0x12, 0x24, 0x0c, 0x30, 0x03, 0x4c, 0x10, 0x11, 0xa9, 0x01, 32 | 0x2d, 0x82, 0x02, 0xf0, 0x03, 0x4c, 0x77, 0x10, 0xa5, 0x81, 0x85, 0x80, 33 | 0x60, 0xa9, 0x03, 0x85, 0x04, 0x85, 0x05, 0xa9, 0x70, 0x85, 0x0d, 0xa9, 34 | 0x31, 0x85, 0x0a, 0xa9, 0x90, 0x85, 0x84, 0xa9, 0x01, 0x85, 0x93, 0xa5, 35 | 0x81, 0xcd, 0xea, 0x1f, 0x90, 0x04, 0xa9, 0x00, 0x85, 0x81, 0x60, 0xa0, 36 | 0x0a, 0xb9, 0x45, 0x11, 0x99, 0x83, 0x00, 0x88, 0x10, 0xf7, 0x4c, 0x83, 37 | 0x00, 0xa2, 0x00, 0xa0, 0x00, 0x88, 0xd0, 0xfd, 0xca, 0xd0, 0xfa, 0x60, 38 | 0xa0, 0x76, 0xb9, 0x7c, 0x11, 0x99, 0x83, 0x00, 0x88, 0x10, 0xf7, 0xa9, 39 | 0x32, 0x85, 0x0a, 0xa9, 0x92, 0x85, 0x09, 0x85, 0x07, 0xa9, 0x08, 0x85, 40 | 0x06, 0xa9, 0x00, 0x85, 0x0d, 0x85, 0x0f, 0x60, 0xa9, 0x30, 0x8d, 0xe6, 41 | 0x1f, 0x85, 0x02, 0x85, 0x02, 0x6c, 0xfc, 0xff, 0xf0, 0x00, 0x18, 0x04, 42 | 0x12, 0xba, 0x90, 0x40, 0x30, 0x00, 0x38, 0x44, 0x10, 0x38, 0x10, 0x44, 43 | 0x38, 0x00, 0x30, 0x40, 0x90, 0xba, 0x12, 0x04, 0x18, 0x00, 0x00, 0x44, 44 | 0x92, 0xba, 0x92, 0x44, 0x00, 0x8e, 0xe6, 0x1f, 0xa9, 0x0e, 0x85, 0x02, 45 | 0x85, 0x00, 0x4a, 0xd0, 0xf9, 0xa2, 0x25, 0x20, 0xf4, 0x00, 0x86, 0x01, 46 | 0xa2, 0x16, 0x20, 0xf4, 0x00, 0xe6, 0x83, 0xa5, 0x83, 0x0a, 0xa2, 0x18, 47 | 0xc9, 0x18, 0xb0, 0x03, 0x29, 0x18, 0xaa, 0x86, 0xd1, 0xa2, 0x8b, 0xa0, 48 | 0x06, 0xb5, 0x00, 0x85, 0x02, 0x85, 0x0e, 0x88, 0x10, 0xf9, 0xca, 0xe0, 49 | 0x83, 0xd0, 0xf0, 0xa2, 0x71, 0x20, 0xf4, 0x00, 0xa9, 0x02, 0x85, 0x01, 50 | 0xa2, 0x1e, 0x20, 0xf4, 0x00, 0xad, 0x00, 0x10, 0xc9, 0xd8, 0xd0, 0xb4, 51 | 0x60, 0x85, 0x02, 0xca, 0xd0, 0xfb, 0x60, 0xa9, 0x0e, 0x85, 0x02, 0x85, 52 | 0x00, 0x4a, 0xd0, 0xf9, 0xe6, 0x83, 0xa9, 0x24, 0x8d, 0x96, 0x02, 0x60, 53 | 0xa2, 0x00, 0xa5, 0x83, 0x4a, 0xa9, 0x00, 0x90, 0x02, 0xa9, 0x03, 0x20, 54 | 0x3b, 0x12, 0xe8, 0xa9, 0x30, 0x20, 0x3b, 0x12, 0xa2, 0x04, 0xa9, 0x52, 55 | 0x20, 0x3b, 0x12, 0x85, 0x02, 0x85, 0x2a, 0x85, 0x02, 0x85, 0x2b, 0xa9, 56 | 0xc0, 0x85, 0x20, 0xa9, 0x80, 0x85, 0x21, 0x60, 0xa9, 0x1a, 0x8d, 0x96, 57 | 0x02, 0xad, 0x84, 0x02, 0xd0, 0xfb, 0x60, 0x38, 0x85, 0x02, 0xe9, 0x0f, 58 | 0xb0, 0xfc, 0x49, 0x07, 0x0a, 0x0a, 0x0a, 0x0a, 0x95, 0x20, 0x9d, 0x10, 59 | 0x00, 0x60, 0xa2, 0xf4, 0xad, 0x84, 0x02, 0xd0, 0xfb, 0x85, 0x02, 0x85, 60 | 0x01, 0x8e, 0x96, 0x02, 0xa9, 0x90, 0x85, 0x09, 0x85, 0x02, 0x85, 0x02, 61 | 0x85, 0x02, 0xa2, 0x00, 0xa5, 0x83, 0x4a, 0x90, 0x02, 0xa2, 0x03, 0x4c, 62 | 0x07, 0x10, 0xa2, 0x02, 0xad, 0x84, 0x02, 0xd0, 0xfb, 0x85, 0x02, 0x86, 63 | 0x01, 0x60, 0xa2, 0x0e, 0xa9, 0x92, 0x95, 0x84, 0xca, 0xd0, 0xfb, 0xa9, 64 | 0x24, 0xa6, 0x81, 0x95, 0x85, 0x60, 0x4c, 0x07, 0x10 65 | }; 66 | -------------------------------------------------------------------------------- /source/STM32firmware/PlusCart/Inc/firmware_uno_ntsc_rom.h: -------------------------------------------------------------------------------- 1 | // To generate: 2 | // First build the PlusCart binary in Atari2600ROM folder (either NTSC/PAL/PAL60 variant) 3 | // the required structure size is output on the command line (e.g., "SIZE: 605") 4 | // Then (MacOS) run (with the correct size value)... 5 | // xxd -g1 -i -len 605 PlusCart.bin 6 | // This will output a c-structure, the contents of which can be inserted below... 7 | 8 | unsigned const char firmware_ntsc_rom[]__attribute__((section(".flash0"))) = { 9 | 10 | 0xd8, 0x8d, 0xf4, 0xff, 0x4c, 0x72, 0x12, 0x9d, 0xf5, 0xff, 0xd8, 0xa9, 11 | 0x00, 0xaa, 0xca, 0x9a, 0xba, 0x48, 0xd0, 0xfc, 0x8d, 0x80, 0x02, 0x8d, 12 | 0x81, 0x02, 0x8d, 0x82, 0x02, 0x8d, 0x83, 0x02, 0xad, 0xf4, 0x1f, 0x20, 13 | 0x37, 0x11, 0x20, 0x50, 0x11, 0xa2, 0xff, 0x20, 0xa4, 0x00, 0x20, 0x5b, 14 | 0x10, 0xad, 0x80, 0x02, 0x10, 0xfb, 0x20, 0x15, 0x11, 0x20, 0x77, 0x10, 15 | 0x20, 0x50, 0x11, 0xa6, 0x80, 0x20, 0xa4, 0x00, 0x20, 0x5b, 0x10, 0xa5, 16 | 0x80, 0xc9, 0x0f, 0xb0, 0xe9, 0xa9, 0x02, 0xcd, 0xeb, 0x1f, 0xf0, 0xe2, 17 | 0xa9, 0x00, 0x85, 0x81, 0x4c, 0x36, 0x10, 0xad, 0xe7, 0x1f, 0xf0, 0x16, 18 | 0xa2, 0x3f, 0xa9, 0x00, 0x95, 0x00, 0xca, 0x10, 0xfb, 0xa2, 0x0b, 0xbd, 19 | 0x70, 0x11, 0x95, 0x83, 0xca, 0x10, 0xf8, 0x4c, 0x83, 0x00, 0x60, 0x20, 20 | 0x7e, 0x12, 0x20, 0xf3, 0x11, 0x20, 0x04, 0x12, 0xa5, 0x93, 0xf0, 0x05, 21 | 0xc6, 0x93, 0x4c, 0xf9, 0x10, 0xa9, 0x20, 0x2d, 0x80, 0x02, 0xf0, 0x07, 22 | 0xa9, 0x02, 0x2d, 0x82, 0x02, 0xd0, 0x0c, 0xa6, 0x81, 0xe8, 0xec, 0xea, 23 | 0x1f, 0xf0, 0x43, 0xe6, 0x81, 0xd0, 0x0d, 0xa9, 0x10, 0x2d, 0x80, 0x02, 24 | 0xd0, 0x0c, 0xa6, 0x81, 0xf0, 0x1a, 0xc6, 0x81, 0xa9, 0x07, 0x85, 0x93, 25 | 0xd0, 0x43, 0xa9, 0x40, 0x2d, 0x80, 0x02, 0xd0, 0x1e, 0x85, 0x81, 0xae, 26 | 0xe8, 0x1f, 0xf0, 0x17, 0xa9, 0x10, 0xd0, 0x4a, 0xae, 0xe8, 0x1f, 0xf0, 27 | 0x0e, 0xa6, 0x82, 0xca, 0x86, 0x81, 0xae, 0xe8, 0x1f, 0xf0, 0x04, 0xa9, 28 | 0x10, 0xd0, 0x37, 0xa9, 0x80, 0x2d, 0x80, 0x02, 0xd0, 0x17, 0xae, 0xea, 29 | 0x1f, 0xca, 0x86, 0x81, 0xae, 0xe8, 0x1f, 0xec, 0xe9, 0x1f, 0xf0, 0x09, 30 | 0xa9, 0x00, 0x85, 0x81, 0xa9, 0x20, 0x4c, 0x12, 0x11, 0x20, 0x4e, 0x12, 31 | 0x20, 0x30, 0x12, 0x24, 0x0c, 0x30, 0x03, 0x4c, 0x10, 0x11, 0xa9, 0x01, 32 | 0x2d, 0x82, 0x02, 0xf0, 0x03, 0x4c, 0x77, 0x10, 0xa5, 0x81, 0x85, 0x80, 33 | 0x60, 0xa9, 0x03, 0x85, 0x04, 0x85, 0x05, 0xa9, 0x70, 0x85, 0x0d, 0xa9, 34 | 0x31, 0x85, 0x0a, 0xa9, 0x90, 0x85, 0x84, 0xa9, 0x01, 0x85, 0x93, 0xa5, 35 | 0x81, 0xcd, 0xea, 0x1f, 0x90, 0x04, 0xa9, 0x00, 0x85, 0x81, 0x60, 0xa0, 36 | 0x0a, 0xb9, 0x45, 0x11, 0x99, 0x83, 0x00, 0x88, 0x10, 0xf7, 0x4c, 0x83, 37 | 0x00, 0xa2, 0x00, 0xa0, 0x00, 0x88, 0xd0, 0xfd, 0xca, 0xd0, 0xfa, 0x60, 38 | 0xa0, 0x76, 0xb9, 0x7c, 0x11, 0x99, 0x83, 0x00, 0x88, 0x10, 0xf7, 0xa9, 39 | 0x32, 0x85, 0x0a, 0xa9, 0x92, 0x85, 0x09, 0x85, 0x07, 0xa9, 0x08, 0x85, 40 | 0x06, 0xa9, 0x00, 0x85, 0x0d, 0x85, 0x0f, 0x60, 0xa9, 0x30, 0x8d, 0xe6, 41 | 0x1f, 0x85, 0x02, 0x85, 0x02, 0x6c, 0xfc, 0xff, 0xf0, 0x00, 0x00, 0x00, 42 | 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x3c, 0x18, 0x00, 43 | 0x00, 0x00, 0x00, 0x4c, 0x2a, 0x6a, 0x4a, 0x2c, 0x00, 0x00, 0xcc, 0x2a, 44 | 0x29, 0x49, 0x89, 0x8a, 0x6c, 0x8e, 0xe6, 0x1f, 0xa9, 0x0e, 0x85, 0x02, 45 | 0x85, 0x00, 0x4a, 0xd0, 0xf9, 0xa2, 0x25, 0x20, 0xf4, 0x00, 0x86, 0x01, 46 | 0xa2, 0x16, 0x20, 0xf4, 0x00, 0xe6, 0x83, 0xa5, 0x83, 0x0a, 0xa2, 0x18, 47 | 0xc9, 0x18, 0xb0, 0x03, 0x29, 0x18, 0xaa, 0x86, 0xd1, 0xa2, 0x8b, 0xa0, 48 | 0x06, 0xb5, 0x00, 0x85, 0x02, 0x85, 0x0e, 0x88, 0x10, 0xf9, 0xca, 0xe0, 49 | 0x83, 0xd0, 0xf0, 0xa2, 0x71, 0x20, 0xf4, 0x00, 0xa9, 0x02, 0x85, 0x01, 50 | 0xa2, 0x1e, 0x20, 0xf4, 0x00, 0xad, 0x00, 0x10, 0xc9, 0xd8, 0xd0, 0xb4, 51 | 0x60, 0x85, 0x02, 0xca, 0xd0, 0xfb, 0x60, 0xa9, 0x0e, 0x85, 0x02, 0x85, 52 | 0x00, 0x4a, 0xd0, 0xf9, 0xe6, 0x83, 0xa9, 0x24, 0x8d, 0x96, 0x02, 0x60, 53 | 0xa2, 0x00, 0xa5, 0x83, 0x4a, 0xa9, 0x00, 0x90, 0x02, 0xa9, 0x03, 0x20, 54 | 0x3b, 0x12, 0xe8, 0xa9, 0x30, 0x20, 0x3b, 0x12, 0xa2, 0x04, 0xa9, 0x52, 55 | 0x20, 0x3b, 0x12, 0x85, 0x02, 0x85, 0x2a, 0x85, 0x02, 0x85, 0x2b, 0xa9, 56 | 0xc0, 0x85, 0x20, 0xa9, 0x80, 0x85, 0x21, 0x60, 0xa9, 0x1a, 0x8d, 0x96, 57 | 0x02, 0xad, 0x84, 0x02, 0xd0, 0xfb, 0x60, 0x38, 0x85, 0x02, 0xe9, 0x0f, 58 | 0xb0, 0xfc, 0x49, 0x07, 0x0a, 0x0a, 0x0a, 0x0a, 0x95, 0x20, 0x9d, 0x10, 59 | 0x00, 0x60, 0xa2, 0xf4, 0xad, 0x84, 0x02, 0xd0, 0xfb, 0x85, 0x02, 0x85, 60 | 0x01, 0x8e, 0x96, 0x02, 0xa9, 0x90, 0x85, 0x09, 0x85, 0x02, 0x85, 0x02, 61 | 0x85, 0x02, 0xa2, 0x00, 0xa5, 0x83, 0x4a, 0x90, 0x02, 0xa2, 0x03, 0x4c, 62 | 0x07, 0x10, 0xa2, 0x02, 0xad, 0x84, 0x02, 0xd0, 0xfb, 0x85, 0x02, 0x86, 63 | 0x01, 0x60, 0xa2, 0x0e, 0xa9, 0x92, 0x95, 0x84, 0xca, 0xd0, 0xfb, 0xa9, 64 | 0x24, 0xa6, 0x81, 0x95, 0x85, 0x60, 0x4c, 0x07, 0x10 65 | }; 66 | -------------------------------------------------------------------------------- /source/STM32firmware/PlusCart/Middlewares/Third_Party/FatFs/src/diskio.c: -------------------------------------------------------------------------------- 1 | /*-----------------------------------------------------------------------*/ 2 | /* Low level disk I/O module skeleton for FatFs (C)ChaN, 2017 */ 3 | /* */ 4 | /* Portions COPYRIGHT 2017 STMicroelectronics */ 5 | /* Portions Copyright (C) 2017, ChaN, all right reserved */ 6 | /*-----------------------------------------------------------------------*/ 7 | /* If a working storage control module is available, it should be */ 8 | /* attached to the FatFs via a glue function rather than modifying it. */ 9 | /* This is an example of glue functions to attach various existing */ 10 | /* storage control modules to the FatFs module with a defined API. */ 11 | /*-----------------------------------------------------------------------*/ 12 | 13 | /* Includes ------------------------------------------------------------------*/ 14 | #include "diskio.h" 15 | #include "ff_gen_drv.h" 16 | 17 | #if defined ( __GNUC__ ) 18 | #ifndef __weak 19 | #define __weak __attribute__((weak)) 20 | #endif 21 | #endif 22 | 23 | /* Private typedef -----------------------------------------------------------*/ 24 | /* Private define ------------------------------------------------------------*/ 25 | /* Private variables ---------------------------------------------------------*/ 26 | extern Disk_drvTypeDef disk; 27 | 28 | /* Private function prototypes -----------------------------------------------*/ 29 | /* Private functions ---------------------------------------------------------*/ 30 | 31 | /** 32 | * @brief Gets Disk Status 33 | * @param pdrv: Physical drive number (0..) 34 | * @retval DSTATUS: Operation status 35 | */ 36 | DSTATUS disk_status ( 37 | BYTE pdrv /* Physical drive number to identify the drive */ 38 | ) 39 | { 40 | DSTATUS stat; 41 | 42 | stat = disk.drv[pdrv]->disk_status(disk.lun[pdrv]); 43 | return stat; 44 | } 45 | 46 | /** 47 | * @brief Initializes a Drive 48 | * @param pdrv: Physical drive number (0..) 49 | * @retval DSTATUS: Operation status 50 | */ 51 | DSTATUS disk_initialize ( 52 | BYTE pdrv /* Physical drive nmuber to identify the drive */ 53 | ) 54 | { 55 | DSTATUS stat = RES_OK; 56 | 57 | if(disk.is_initialized[pdrv] == 0) 58 | { 59 | disk.is_initialized[pdrv] = 1; 60 | stat = disk.drv[pdrv]->disk_initialize(disk.lun[pdrv]); 61 | } 62 | return stat; 63 | } 64 | 65 | /** 66 | * @brief Reads Sector(s) 67 | * @param pdrv: Physical drive number (0..) 68 | * @param *buff: Data buffer to store read data 69 | * @param sector: Sector address (LBA) 70 | * @param count: Number of sectors to read (1..128) 71 | * @retval DRESULT: Operation result 72 | */ 73 | DRESULT disk_read ( 74 | BYTE pdrv, /* Physical drive nmuber to identify the drive */ 75 | BYTE *buff, /* Data buffer to store read data */ 76 | DWORD sector, /* Sector address in LBA */ 77 | UINT count /* Number of sectors to read */ 78 | ) 79 | { 80 | DRESULT res; 81 | 82 | res = disk.drv[pdrv]->disk_read(disk.lun[pdrv], buff, sector, count); 83 | return res; 84 | } 85 | 86 | /** 87 | * @brief Writes Sector(s) 88 | * @param pdrv: Physical drive number (0..) 89 | * @param *buff: Data to be written 90 | * @param sector: Sector address (LBA) 91 | * @param count: Number of sectors to write (1..128) 92 | * @retval DRESULT: Operation result 93 | */ 94 | #if _USE_WRITE == 1 95 | DRESULT disk_write ( 96 | BYTE pdrv, /* Physical drive nmuber to identify the drive */ 97 | const BYTE *buff, /* Data to be written */ 98 | DWORD sector, /* Sector address in LBA */ 99 | UINT count /* Number of sectors to write */ 100 | ) 101 | { 102 | DRESULT res; 103 | 104 | res = disk.drv[pdrv]->disk_write(disk.lun[pdrv], buff, sector, count); 105 | return res; 106 | } 107 | #endif /* _USE_WRITE == 1 */ 108 | 109 | /** 110 | * @brief I/O control operation 111 | * @param pdrv: Physical drive number (0..) 112 | * @param cmd: Control code 113 | * @param *buff: Buffer to send/receive control data 114 | * @retval DRESULT: Operation result 115 | */ 116 | #if _USE_IOCTL == 1 117 | DRESULT disk_ioctl ( 118 | BYTE pdrv, /* Physical drive nmuber (0..) */ 119 | BYTE cmd, /* Control code */ 120 | void *buff /* Buffer to send/receive control data */ 121 | ) 122 | { 123 | DRESULT res; 124 | 125 | res = disk.drv[pdrv]->disk_ioctl(disk.lun[pdrv], cmd, buff); 126 | return res; 127 | } 128 | #endif /* _USE_IOCTL == 1 */ 129 | 130 | /** 131 | * @brief Gets Time from RTC 132 | * @param None 133 | * @retval Time in DWORD 134 | */ 135 | __weak DWORD get_fattime (void) 136 | { 137 | return 0; 138 | } 139 | 140 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 141 | 142 | -------------------------------------------------------------------------------- /source/STM32firmware/PlusCart/Src/syscalls.c: -------------------------------------------------------------------------------- 1 | /** 2 | ***************************************************************************** 3 | ** 4 | ** File : syscalls.c 5 | ** 6 | ** Author : Auto-generated by STM32CubeIDE 7 | ** 8 | ** Abstract : STM32CubeIDE Minimal System calls file 9 | ** 10 | ** For more information about which c-functions 11 | ** need which of these lowlevel functions 12 | ** please consult the Newlib libc-manual 13 | ** 14 | ** Environment : STM32CubeIDE MCU 15 | ** 16 | ** Distribution: The file is distributed as is, without any warranty 17 | ** of any kind. 18 | ** 19 | ***************************************************************************** 20 | ** 21 | **

© COPYRIGHT(c) 2018 STMicroelectronics

22 | ** 23 | ** Redistribution and use in source and binary forms, with or without modification, 24 | ** are permitted provided that the following conditions are met: 25 | ** 1. Redistributions of source code must retain the above copyright notice, 26 | ** this list of conditions and the following disclaimer. 27 | ** 2. Redistributions in binary form must reproduce the above copyright notice, 28 | ** this list of conditions and the following disclaimer in the documentation 29 | ** and/or other materials provided with the distribution. 30 | ** 3. Neither the name of STMicroelectronics nor the names of its contributors 31 | ** may be used to endorse or promote products derived from this software 32 | ** without specific prior written permission. 33 | ** 34 | ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 35 | ** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 36 | ** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 37 | ** DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 38 | ** FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 39 | ** DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 40 | ** SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 41 | ** CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 42 | ** OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 43 | ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 44 | ** 45 | ** 46 | ***************************************************************************** 47 | */ 48 | 49 | /* Includes */ 50 | #include 51 | #include 52 | #include 53 | #include 54 | #include 55 | #include 56 | #include 57 | #include 58 | 59 | 60 | /* Variables */ 61 | //#undef errno 62 | extern int errno; 63 | extern int __io_putchar(int ch) __attribute__((weak)); 64 | extern int __io_getchar(void) __attribute__((weak)); 65 | 66 | register char * stack_ptr asm("sp"); 67 | 68 | char *__env[1] = { 0 }; 69 | char **environ = __env; 70 | 71 | 72 | /* Functions */ 73 | void initialise_monitor_handles() 74 | { 75 | } 76 | 77 | int _getpid(void) 78 | { 79 | return 1; 80 | } 81 | 82 | int _kill(int pid, int sig) 83 | { 84 | errno = EINVAL; 85 | return -1; 86 | } 87 | 88 | void _exit (int status) 89 | { 90 | _kill(status, -1); 91 | while (1) {} /* Make sure we hang here */ 92 | } 93 | 94 | __attribute__((weak)) int _read(int file, char *ptr, int len) 95 | { 96 | int DataIdx; 97 | 98 | for (DataIdx = 0; DataIdx < len; DataIdx++) 99 | { 100 | *ptr++ = (char)(__io_getchar()); 101 | } 102 | 103 | return len; 104 | } 105 | 106 | __attribute__((weak)) int _write(int file, char *ptr, int len) 107 | { 108 | int DataIdx; 109 | 110 | for (DataIdx = 0; DataIdx < len; DataIdx++) 111 | { 112 | __io_putchar(*ptr++); 113 | } 114 | return len; 115 | } 116 | 117 | int _close(int file) 118 | { 119 | return -1; 120 | } 121 | 122 | 123 | int _fstat(int file, struct stat *st) 124 | { 125 | st->st_mode = S_IFCHR; 126 | return 0; 127 | } 128 | 129 | int _isatty(int file) 130 | { 131 | return 1; 132 | } 133 | 134 | int _lseek(int file, int ptr, int dir) 135 | { 136 | return 0; 137 | } 138 | 139 | int _open(char *path, int flags, ...) 140 | { 141 | /* Pretend like we always fail */ 142 | return -1; 143 | } 144 | 145 | int _wait(int *status) 146 | { 147 | errno = ECHILD; 148 | return -1; 149 | } 150 | 151 | int _unlink(char *name) 152 | { 153 | errno = ENOENT; 154 | return -1; 155 | } 156 | 157 | int _times(struct tms *buf) 158 | { 159 | return -1; 160 | } 161 | 162 | int _stat(char *file, struct stat *st) 163 | { 164 | st->st_mode = S_IFCHR; 165 | return 0; 166 | } 167 | 168 | int _link(char *old, char *new) 169 | { 170 | errno = EMLINK; 171 | return -1; 172 | } 173 | 174 | int _fork(void) 175 | { 176 | errno = EAGAIN; 177 | return -1; 178 | } 179 | 180 | int _execve(char *name, char **argv, char **env) 181 | { 182 | errno = ENOMEM; 183 | return -1; 184 | } 185 | -------------------------------------------------------------------------------- /source/ElfTests/debug/stm32f4_flash.ld: -------------------------------------------------------------------------------- 1 | /* 2 | ****************************************************************************** 3 | File: stm32f4_flash.ld 4 | Info: Generated by Atollic TrueSTUDIO(R) 9.0.1 2018-06-20 5 | 6 | Abstract: Linker script for STM32F407VG device 7 | Set heap size, stack size, stack location, memory areas and 8 | sections according to application requirements. 9 | 10 | The MIT License (MIT) 11 | Copyright (c) 2018 STMicroelectronics 12 | 13 | Permission is hereby granted, free of charge, to any person obtaining a copy 14 | of this software and associated documentation files (the "Software"), to deal 15 | in the Software without restriction, including without limitation the rights 16 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 17 | copies of the Software, and to permit persons to whom the Software is 18 | furnished to do so, subject to the following conditions: 19 | 20 | The above copyright notice and this permission notice shall be included in all 21 | copies or substantial portions of the Software. 22 | 23 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 24 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 25 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 26 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 27 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 28 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 29 | SOFTWARE. 30 | 31 | ****************************************************************************** 32 | */ 33 | 34 | /* Highest address of the user mode stack */ 35 | _estack = 0x20020000; /* end of 128K RAM */ 36 | 37 | /* Generate a link error if heap and stack don't fit into RAM */ 38 | _Min_Heap_Size = 0; /* required amount of heap */ 39 | _Min_Stack_Size = 0x400; /* required amount of stack */ 40 | _Flash_Origin = 0x08010000; 41 | 42 | /* Specify the memory areas */ 43 | MEMORY 44 | { 45 | HEADER (rx) : ORIGIN = _Flash_Origin, LENGTH = 64K 46 | FLASH (rx) : ORIGIN = _Flash_Origin + 0x10000, LENGTH = 384K 47 | RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 128K 48 | MEMORY_B1 (rx) : ORIGIN = 0x60000000, LENGTH = 0K 49 | } 50 | 51 | /* Define output sections */ 52 | SECTIONS 53 | { 54 | /* The program code and other data goes into FLASH */ 55 | .text : 56 | { 57 | . = ALIGN(4); 58 | *(.text) /* .text sections (code) */ 59 | *(.text*) /* .text* sections (code) */ 60 | . = ALIGN(4); 61 | _etext = .; /* define a global symbols at end of code */ 62 | } >FLASH 63 | 64 | /* Constant data goes into FLASH */ 65 | .rodata : 66 | { 67 | *(.rodata) /* .rodata sections (constants, strings, etc.) */ 68 | *(.rodata*) /* .rodata* sections (constants, strings, etc.) */ 69 | . = ALIGN(4); 70 | } >FLASH 71 | 72 | .preinit_array : 73 | { 74 | PROVIDE_HIDDEN (__preinit_array_start = .); 75 | KEEP (*(.preinit_array*)) 76 | PROVIDE_HIDDEN (__preinit_array_end = .); 77 | } >FLASH 78 | .init_array : 79 | { 80 | PROVIDE_HIDDEN (__init_array_start = .); 81 | KEEP (*(SORT(.init_array.*))) 82 | KEEP (*(.init_array*)) 83 | PROVIDE_HIDDEN (__init_array_end = .); 84 | } >FLASH 85 | .fini_array : 86 | { 87 | PROVIDE_HIDDEN (__fini_array_start = .); 88 | KEEP (*(SORT(.fini_array.*))) 89 | KEEP (*(.fini_array*)) 90 | PROVIDE_HIDDEN (__fini_array_end = .); 91 | } >FLASH 92 | 93 | /* used by the startup to initialize data */ 94 | _sidata = LOADADDR(.data); 95 | 96 | /* Initialized data sections goes into RAM, load LMA copy after code */ 97 | .data : 98 | { 99 | . = ALIGN(4); 100 | _sdata = .; /* create a global symbol at data start */ 101 | *(.data) /* .data sections */ 102 | *(.data*) /* .data* sections */ 103 | 104 | . = ALIGN(4); 105 | _edata = .; /* define a global symbol at data end */ 106 | } >RAM AT> FLASH 107 | 108 | /* Uninitialized data section */ 109 | . = ALIGN(4); 110 | .bss : 111 | { 112 | /* This is used by the startup in order to initialize the .bss secion */ 113 | _sbss = .; /* define a global symbol at bss start */ 114 | __bss_start__ = _sbss; 115 | *(.bss) 116 | *(.bss*) 117 | *(COMMON) 118 | 119 | . = ALIGN(4); 120 | _ebss = .; /* define a global symbol at bss end */ 121 | __bss_end__ = _ebss; 122 | } >RAM 123 | 124 | /* User_heap_stack section, used to check that there is enough RAM left */ 125 | ._user_heap_stack : 126 | { 127 | . = ALIGN(4); 128 | PROVIDE ( end = . ); 129 | PROVIDE ( _end = . ); 130 | . = . + _Min_Heap_Size; 131 | . = . + _Min_Stack_Size; 132 | . = ALIGN(4); 133 | } >RAM 134 | 135 | 136 | .ARM.attributes 0 : { *(.ARM.attributes) } 137 | 138 | .EOF_MARKER : { 139 | __file_size = . - _Flash_Origin; 140 | } >FLASH 141 | } 142 | -------------------------------------------------------------------------------- /source/ElfTests/region/stm32f4_flash.ld: -------------------------------------------------------------------------------- 1 | /* 2 | ****************************************************************************** 3 | File: stm32f4_flash.ld 4 | Info: Generated by Atollic TrueSTUDIO(R) 9.0.1 2018-06-20 5 | 6 | Abstract: Linker script for STM32F407VG device 7 | Set heap size, stack size, stack location, memory areas and 8 | sections according to application requirements. 9 | 10 | The MIT License (MIT) 11 | Copyright (c) 2018 STMicroelectronics 12 | 13 | Permission is hereby granted, free of charge, to any person obtaining a copy 14 | of this software and associated documentation files (the "Software"), to deal 15 | in the Software without restriction, including without limitation the rights 16 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 17 | copies of the Software, and to permit persons to whom the Software is 18 | furnished to do so, subject to the following conditions: 19 | 20 | The above copyright notice and this permission notice shall be included in all 21 | copies or substantial portions of the Software. 22 | 23 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 24 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 25 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 26 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 27 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 28 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 29 | SOFTWARE. 30 | 31 | ****************************************************************************** 32 | */ 33 | 34 | /* Highest address of the user mode stack */ 35 | _estack = 0x20020000; /* end of 128K RAM */ 36 | 37 | /* Generate a link error if heap and stack don't fit into RAM */ 38 | _Min_Heap_Size = 0; /* required amount of heap */ 39 | _Min_Stack_Size = 0x400; /* required amount of stack */ 40 | _Flash_Origin = 0x08010000; 41 | 42 | /* Specify the memory areas */ 43 | MEMORY 44 | { 45 | HEADER (rx) : ORIGIN = _Flash_Origin, LENGTH = 64K 46 | FLASH (rx) : ORIGIN = _Flash_Origin + 0x10000, LENGTH = 384K 47 | RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 128K 48 | MEMORY_B1 (rx) : ORIGIN = 0x60000000, LENGTH = 0K 49 | } 50 | 51 | /* Define output sections */ 52 | SECTIONS 53 | { 54 | /* The program code and other data goes into FLASH */ 55 | .text : 56 | { 57 | . = ALIGN(4); 58 | *(.text) /* .text sections (code) */ 59 | *(.text*) /* .text* sections (code) */ 60 | . = ALIGN(4); 61 | _etext = .; /* define a global symbols at end of code */ 62 | } >FLASH 63 | 64 | /* Constant data goes into FLASH */ 65 | .rodata : 66 | { 67 | *(.rodata) /* .rodata sections (constants, strings, etc.) */ 68 | *(.rodata*) /* .rodata* sections (constants, strings, etc.) */ 69 | . = ALIGN(4); 70 | } >FLASH 71 | 72 | .preinit_array : 73 | { 74 | PROVIDE_HIDDEN (__preinit_array_start = .); 75 | KEEP (*(.preinit_array*)) 76 | PROVIDE_HIDDEN (__preinit_array_end = .); 77 | } >FLASH 78 | .init_array : 79 | { 80 | PROVIDE_HIDDEN (__init_array_start = .); 81 | KEEP (*(SORT(.init_array.*))) 82 | KEEP (*(.init_array*)) 83 | PROVIDE_HIDDEN (__init_array_end = .); 84 | } >FLASH 85 | .fini_array : 86 | { 87 | PROVIDE_HIDDEN (__fini_array_start = .); 88 | KEEP (*(SORT(.fini_array.*))) 89 | KEEP (*(.fini_array*)) 90 | PROVIDE_HIDDEN (__fini_array_end = .); 91 | } >FLASH 92 | 93 | /* used by the startup to initialize data */ 94 | _sidata = LOADADDR(.data); 95 | 96 | /* Initialized data sections goes into RAM, load LMA copy after code */ 97 | .data : 98 | { 99 | . = ALIGN(4); 100 | _sdata = .; /* create a global symbol at data start */ 101 | *(.data) /* .data sections */ 102 | *(.data*) /* .data* sections */ 103 | 104 | . = ALIGN(4); 105 | _edata = .; /* define a global symbol at data end */ 106 | } >RAM AT> FLASH 107 | 108 | /* Uninitialized data section */ 109 | . = ALIGN(4); 110 | .bss : 111 | { 112 | /* This is used by the startup in order to initialize the .bss secion */ 113 | _sbss = .; /* define a global symbol at bss start */ 114 | __bss_start__ = _sbss; 115 | *(.bss) 116 | *(.bss*) 117 | *(COMMON) 118 | 119 | . = ALIGN(4); 120 | _ebss = .; /* define a global symbol at bss end */ 121 | __bss_end__ = _ebss; 122 | } >RAM 123 | 124 | /* User_heap_stack section, used to check that there is enough RAM left */ 125 | ._user_heap_stack : 126 | { 127 | . = ALIGN(4); 128 | PROVIDE ( end = . ); 129 | PROVIDE ( _end = . ); 130 | . = . + _Min_Heap_Size; 131 | . = . + _Min_Stack_Size; 132 | . = ALIGN(4); 133 | } >RAM 134 | 135 | 136 | .ARM.attributes 0 : { *(.ARM.attributes) } 137 | 138 | .EOF_MARKER : { 139 | __file_size = . - _Flash_Origin; 140 | } >FLASH 141 | } 142 | -------------------------------------------------------------------------------- /source/ElfTests/raycaster/stm32f4_flash.ld: -------------------------------------------------------------------------------- 1 | /* 2 | ****************************************************************************** 3 | File: stm32f4_flash.ld 4 | Info: Generated by Atollic TrueSTUDIO(R) 9.0.1 2018-06-20 5 | 6 | Abstract: Linker script for STM32F407VG device 7 | Set heap size, stack size, stack location, memory areas and 8 | sections according to application requirements. 9 | 10 | The MIT License (MIT) 11 | Copyright (c) 2018 STMicroelectronics 12 | 13 | Permission is hereby granted, free of charge, to any person obtaining a copy 14 | of this software and associated documentation files (the "Software"), to deal 15 | in the Software without restriction, including without limitation the rights 16 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 17 | copies of the Software, and to permit persons to whom the Software is 18 | furnished to do so, subject to the following conditions: 19 | 20 | The above copyright notice and this permission notice shall be included in all 21 | copies or substantial portions of the Software. 22 | 23 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 24 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 25 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 26 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 27 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 28 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 29 | SOFTWARE. 30 | 31 | ****************************************************************************** 32 | */ 33 | 34 | /* Highest address of the user mode stack */ 35 | _estack = 0x20020000; /* end of 128K RAM */ 36 | 37 | /* Generate a link error if heap and stack don't fit into RAM */ 38 | _Min_Heap_Size = 0; /* required amount of heap */ 39 | _Min_Stack_Size = 0x400; /* required amount of stack */ 40 | _Flash_Origin = 0x08010000; 41 | 42 | /* Specify the memory areas */ 43 | MEMORY 44 | { 45 | HEADER (rx) : ORIGIN = _Flash_Origin, LENGTH = 64K 46 | FLASH (rx) : ORIGIN = _Flash_Origin + 0x10000, LENGTH = 384K 47 | RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 128K 48 | MEMORY_B1 (rx) : ORIGIN = 0x60000000, LENGTH = 0K 49 | } 50 | 51 | /* Define output sections */ 52 | SECTIONS 53 | { 54 | /* The program code and other data goes into FLASH */ 55 | .text : 56 | { 57 | . = ALIGN(4); 58 | *(.text) /* .text sections (code) */ 59 | *(.text*) /* .text* sections (code) */ 60 | . = ALIGN(4); 61 | _etext = .; /* define a global symbols at end of code */ 62 | } >FLASH 63 | 64 | /* Constant data goes into FLASH */ 65 | .rodata : 66 | { 67 | *(.rodata) /* .rodata sections (constants, strings, etc.) */ 68 | *(.rodata*) /* .rodata* sections (constants, strings, etc.) */ 69 | . = ALIGN(4); 70 | } >FLASH 71 | 72 | .preinit_array : 73 | { 74 | PROVIDE_HIDDEN (__preinit_array_start = .); 75 | KEEP (*(.preinit_array*)) 76 | PROVIDE_HIDDEN (__preinit_array_end = .); 77 | } >FLASH 78 | .init_array : 79 | { 80 | PROVIDE_HIDDEN (__init_array_start = .); 81 | KEEP (*(SORT(.init_array.*))) 82 | KEEP (*(.init_array*)) 83 | PROVIDE_HIDDEN (__init_array_end = .); 84 | } >FLASH 85 | .fini_array : 86 | { 87 | PROVIDE_HIDDEN (__fini_array_start = .); 88 | KEEP (*(SORT(.fini_array.*))) 89 | KEEP (*(.fini_array*)) 90 | PROVIDE_HIDDEN (__fini_array_end = .); 91 | } >FLASH 92 | 93 | /* used by the startup to initialize data */ 94 | _sidata = LOADADDR(.data); 95 | 96 | /* Initialized data sections goes into RAM, load LMA copy after code */ 97 | .data : 98 | { 99 | . = ALIGN(4); 100 | _sdata = .; /* create a global symbol at data start */ 101 | *(.data) /* .data sections */ 102 | *(.data*) /* .data* sections */ 103 | 104 | . = ALIGN(4); 105 | _edata = .; /* define a global symbol at data end */ 106 | } >RAM AT> FLASH 107 | 108 | /* Uninitialized data section */ 109 | . = ALIGN(4); 110 | .bss : 111 | { 112 | /* This is used by the startup in order to initialize the .bss secion */ 113 | _sbss = .; /* define a global symbol at bss start */ 114 | __bss_start__ = _sbss; 115 | *(.bss) 116 | *(.bss*) 117 | *(COMMON) 118 | 119 | . = ALIGN(4); 120 | _ebss = .; /* define a global symbol at bss end */ 121 | __bss_end__ = _ebss; 122 | } >RAM 123 | 124 | /* User_heap_stack section, used to check that there is enough RAM left */ 125 | ._user_heap_stack : 126 | { 127 | . = ALIGN(4); 128 | PROVIDE ( end = . ); 129 | PROVIDE ( _end = . ); 130 | . = . + _Min_Heap_Size; 131 | . = . + _Min_Stack_Size; 132 | . = ALIGN(4); 133 | } >RAM 134 | 135 | 136 | .ARM.attributes 0 : { *(.ARM.attributes) } 137 | 138 | .EOF_MARKER : { 139 | __file_size = . - _Flash_Origin; 140 | } >FLASH 141 | } 142 | -------------------------------------------------------------------------------- /source/ElfTests/rom-elf/stm32f4_flash.ld: -------------------------------------------------------------------------------- 1 | /* 2 | ****************************************************************************** 3 | File: stm32f4_flash.ld 4 | Info: Generated by Atollic TrueSTUDIO(R) 9.0.1 2018-06-20 5 | 6 | Abstract: Linker script for STM32F407VG device 7 | Set heap size, stack size, stack location, memory areas and 8 | sections according to application requirements. 9 | 10 | The MIT License (MIT) 11 | Copyright (c) 2018 STMicroelectronics 12 | 13 | Permission is hereby granted, free of charge, to any person obtaining a copy 14 | of this software and associated documentation files (the "Software"), to deal 15 | in the Software without restriction, including without limitation the rights 16 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 17 | copies of the Software, and to permit persons to whom the Software is 18 | furnished to do so, subject to the following conditions: 19 | 20 | The above copyright notice and this permission notice shall be included in all 21 | copies or substantial portions of the Software. 22 | 23 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 24 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 25 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 26 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 27 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 28 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 29 | SOFTWARE. 30 | 31 | ****************************************************************************** 32 | */ 33 | 34 | /* Highest address of the user mode stack */ 35 | _estack = 0x20020000; /* end of 128K RAM */ 36 | 37 | /* Generate a link error if heap and stack don't fit into RAM */ 38 | _Min_Heap_Size = 0; /* required amount of heap */ 39 | _Min_Stack_Size = 0x400; /* required amount of stack */ 40 | _Flash_Origin = 0x08010000; 41 | 42 | /* Specify the memory areas */ 43 | MEMORY 44 | { 45 | HEADER (rx) : ORIGIN = _Flash_Origin, LENGTH = 64K 46 | FLASH (rx) : ORIGIN = _Flash_Origin + 0x10000, LENGTH = 384K 47 | RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 128K 48 | MEMORY_B1 (rx) : ORIGIN = 0x60000000, LENGTH = 0K 49 | } 50 | 51 | /* Define output sections */ 52 | SECTIONS 53 | { 54 | /* The program code and other data goes into FLASH */ 55 | .text : 56 | { 57 | . = ALIGN(4); 58 | *(.text) /* .text sections (code) */ 59 | *(.text*) /* .text* sections (code) */ 60 | . = ALIGN(4); 61 | _etext = .; /* define a global symbols at end of code */ 62 | } >FLASH 63 | 64 | /* Constant data goes into FLASH */ 65 | .rodata : 66 | { 67 | *(.rodata) /* .rodata sections (constants, strings, etc.) */ 68 | *(.rodata*) /* .rodata* sections (constants, strings, etc.) */ 69 | . = ALIGN(4); 70 | } >FLASH 71 | 72 | .preinit_array : 73 | { 74 | PROVIDE_HIDDEN (__preinit_array_start = .); 75 | KEEP (*(.preinit_array*)) 76 | PROVIDE_HIDDEN (__preinit_array_end = .); 77 | } >FLASH 78 | .init_array : 79 | { 80 | PROVIDE_HIDDEN (__init_array_start = .); 81 | KEEP (*(SORT(.init_array.*))) 82 | KEEP (*(.init_array*)) 83 | PROVIDE_HIDDEN (__init_array_end = .); 84 | } >FLASH 85 | .fini_array : 86 | { 87 | PROVIDE_HIDDEN (__fini_array_start = .); 88 | KEEP (*(SORT(.fini_array.*))) 89 | KEEP (*(.fini_array*)) 90 | PROVIDE_HIDDEN (__fini_array_end = .); 91 | } >FLASH 92 | 93 | /* used by the startup to initialize data */ 94 | _sidata = LOADADDR(.data); 95 | 96 | /* Initialized data sections goes into RAM, load LMA copy after code */ 97 | .data : 98 | { 99 | . = ALIGN(4); 100 | _sdata = .; /* create a global symbol at data start */ 101 | *(.data) /* .data sections */ 102 | *(.data*) /* .data* sections */ 103 | 104 | . = ALIGN(4); 105 | _edata = .; /* define a global symbol at data end */ 106 | } >RAM AT> FLASH 107 | 108 | /* Uninitialized data section */ 109 | . = ALIGN(4); 110 | .bss : 111 | { 112 | /* This is used by the startup in order to initialize the .bss secion */ 113 | _sbss = .; /* define a global symbol at bss start */ 114 | __bss_start__ = _sbss; 115 | *(.bss) 116 | *(.bss*) 117 | *(COMMON) 118 | 119 | . = ALIGN(4); 120 | _ebss = .; /* define a global symbol at bss end */ 121 | __bss_end__ = _ebss; 122 | } >RAM 123 | 124 | /* User_heap_stack section, used to check that there is enough RAM left */ 125 | ._user_heap_stack : 126 | { 127 | . = ALIGN(4); 128 | PROVIDE ( end = . ); 129 | PROVIDE ( _end = . ); 130 | . = . + _Min_Heap_Size; 131 | . = . + _Min_Stack_Size; 132 | . = ALIGN(4); 133 | } >RAM 134 | 135 | 136 | .ARM.attributes 0 : { *(.ARM.attributes) } 137 | 138 | .EOF_MARKER : { 139 | __file_size = . - _Flash_Origin; 140 | } >FLASH 141 | } 142 | -------------------------------------------------------------------------------- /source/STM32firmware/PlusCart/Src/user_diskio.c: -------------------------------------------------------------------------------- 1 | /* USER CODE BEGIN Header */ 2 | /** 3 | ****************************************************************************** 4 | * @file user_diskio.c 5 | * @brief This file includes a diskio driver skeleton to be completed by the user. 6 | ****************************************************************************** 7 | * @attention 8 | * 9 | *

© Copyright (c) 2020 STMicroelectronics. 10 | * All rights reserved.

11 | * 12 | * This software component is licensed by ST under Ultimate Liberty license 13 | * SLA0044, the "License"; You may not use this file except in compliance with 14 | * the License. You may obtain a copy of the License at: 15 | * www.st.com/SLA0044 16 | * 17 | ****************************************************************************** 18 | */ 19 | /* USER CODE END Header */ 20 | 21 | #ifdef USE_OBSOLETE_USER_CODE_SECTION_0 22 | /* 23 | * Warning: the user section 0 is no more in use (starting from CubeMx version 4.16.0) 24 | * To be suppressed in the future. 25 | * Kept to ensure backward compatibility with previous CubeMx versions when 26 | * migrating projects. 27 | * User code previously added there should be copied in the new user sections before 28 | * the section contents can be deleted. 29 | */ 30 | /* USER CODE BEGIN 0 */ 31 | /* USER CODE END 0 */ 32 | #endif 33 | 34 | /* USER CODE BEGIN DECL */ 35 | 36 | /* Includes ------------------------------------------------------------------*/ 37 | #include 38 | #include "ff_gen_drv.h" 39 | #include "user_diskio_spi.h" 40 | 41 | /* Private typedef -----------------------------------------------------------*/ 42 | /* Private define ------------------------------------------------------------*/ 43 | 44 | /* Private variables ---------------------------------------------------------*/ 45 | /* Disk status */ 46 | static volatile DSTATUS Stat = STA_NOINIT; 47 | 48 | /* USER CODE END DECL */ 49 | 50 | /* Private function prototypes -----------------------------------------------*/ 51 | DSTATUS USER_initialize (BYTE pdrv); 52 | DSTATUS USER_status (BYTE pdrv); 53 | DRESULT USER_read (BYTE pdrv, BYTE *buff, DWORD sector, UINT count); 54 | #if _USE_WRITE == 1 55 | DRESULT USER_write (BYTE pdrv, const BYTE *buff, DWORD sector, UINT count); 56 | #endif /* _USE_WRITE == 1 */ 57 | #if _USE_IOCTL == 1 58 | DRESULT USER_ioctl (BYTE pdrv, BYTE cmd, void *buff); 59 | #endif /* _USE_IOCTL == 1 */ 60 | 61 | Diskio_drvTypeDef USER_Driver = 62 | { 63 | USER_initialize, 64 | USER_status, 65 | USER_read, 66 | #if _USE_WRITE 67 | USER_write, 68 | #endif /* _USE_WRITE == 1 */ 69 | #if _USE_IOCTL == 1 70 | USER_ioctl, 71 | #endif /* _USE_IOCTL == 1 */ 72 | }; 73 | 74 | /* Private functions ---------------------------------------------------------*/ 75 | 76 | /** 77 | * @brief Initializes a Drive 78 | * @param pdrv: Physical drive number (0..) 79 | * @retval DSTATUS: Operation status 80 | */ 81 | DSTATUS USER_initialize ( 82 | BYTE pdrv /* Physical drive nmuber to identify the drive */ 83 | ) 84 | { 85 | /* USER CODE BEGIN INIT */ 86 | return USER_SPI_initialize(pdrv); 87 | /* USER CODE END INIT */ 88 | } 89 | 90 | /** 91 | * @brief Gets Disk Status 92 | * @param pdrv: Physical drive number (0..) 93 | * @retval DSTATUS: Operation status 94 | */ 95 | DSTATUS USER_status ( 96 | BYTE pdrv /* Physical drive number to identify the drive */ 97 | ) 98 | { 99 | /* USER CODE BEGIN STATUS */ 100 | return USER_SPI_status(pdrv); 101 | /* USER CODE END STATUS */ 102 | } 103 | 104 | /** 105 | * @brief Reads Sector(s) 106 | * @param pdrv: Physical drive number (0..) 107 | * @param *buff: Data buffer to store read data 108 | * @param sector: Sector address (LBA) 109 | * @param count: Number of sectors to read (1..128) 110 | * @retval DRESULT: Operation result 111 | */ 112 | DRESULT USER_read ( 113 | BYTE pdrv, /* Physical drive nmuber to identify the drive */ 114 | BYTE *buff, /* Data buffer to store read data */ 115 | DWORD sector, /* Sector address in LBA */ 116 | UINT count /* Number of sectors to read */ 117 | ) 118 | { 119 | /* USER CODE BEGIN READ */ 120 | return USER_SPI_read(pdrv, buff, sector, count); 121 | /* USER CODE END READ */ 122 | } 123 | 124 | /** 125 | * @brief Writes Sector(s) 126 | * @param pdrv: Physical drive number (0..) 127 | * @param *buff: Data to be written 128 | * @param sector: Sector address (LBA) 129 | * @param count: Number of sectors to write (1..128) 130 | * @retval DRESULT: Operation result 131 | */ 132 | #if _USE_WRITE == 1 133 | DRESULT USER_write ( 134 | BYTE pdrv, /* Physical drive nmuber to identify the drive */ 135 | const BYTE *buff, /* Data to be written */ 136 | DWORD sector, /* Sector address in LBA */ 137 | UINT count /* Number of sectors to write */ 138 | ) 139 | { 140 | /* USER CODE BEGIN WRITE */ 141 | /* USER CODE HERE */ 142 | return USER_SPI_write(pdrv, buff, sector, count); 143 | /* USER CODE END WRITE */ 144 | } 145 | #endif /* _USE_WRITE == 1 */ 146 | 147 | /** 148 | * @brief I/O control operation 149 | * @param pdrv: Physical drive number (0..) 150 | * @param cmd: Control code 151 | * @param *buff: Buffer to send/receive control data 152 | * @retval DRESULT: Operation result 153 | */ 154 | #if _USE_IOCTL == 1 155 | DRESULT USER_ioctl ( 156 | BYTE pdrv, /* Physical drive nmuber (0..) */ 157 | BYTE cmd, /* Control code */ 158 | void *buff /* Buffer to send/receive control data */ 159 | ) 160 | { 161 | /* USER CODE BEGIN IOCTL */ 162 | return USER_SPI_ioctl(pdrv, cmd, buff); 163 | /* USER CODE END IOCTL */ 164 | } 165 | #endif /* _USE_IOCTL == 1 */ 166 | 167 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 168 | -------------------------------------------------------------------------------- /source/STM32firmware/PlusCart/Middlewares/Third_Party/FatFs/src/option/syscall.c: -------------------------------------------------------------------------------- 1 | /*------------------------------------------------------------------------*/ 2 | /* Sample code of OS dependent controls for FatFs */ 3 | /* (C)ChaN, 2014 */ 4 | /* Portions COPYRIGHT 2017 STMicroelectronics */ 5 | /* Portions Copyright (C) 2014, ChaN, all right reserved */ 6 | /*------------------------------------------------------------------------*/ 7 | 8 | /** 9 | ****************************************************************************** 10 | * @attention 11 | * 12 | * Copyright (c) 2017 STMicroelectronics. All rights reserved. 13 | * 14 | * This software component is licensed by ST under BSD 3-Clause license, 15 | * the "License"; You may not use this file except in compliance with the 16 | * License. You may obtain a copy of the License at: 17 | * opensource.org/licenses/BSD-3-Clause 18 | * 19 | ****************************************************************************** 20 | **/ 21 | 22 | 23 | 24 | #include "../ff.h" 25 | 26 | 27 | #if _FS_REENTRANT 28 | /*------------------------------------------------------------------------*/ 29 | /* Create a Synchronization Object */ 30 | /*------------------------------------------------------------------------*/ 31 | /* This function is called in f_mount() function to create a new 32 | / synchronization object, such as semaphore and mutex. When a 0 is returned, 33 | / the f_mount() function fails with FR_INT_ERR. 34 | */ 35 | 36 | int ff_cre_syncobj ( /* 1:Function succeeded, 0:Could not create the sync object */ 37 | BYTE vol, /* Corresponding volume (logical drive number) */ 38 | _SYNC_t *sobj /* Pointer to return the created sync object */ 39 | ) 40 | { 41 | 42 | int ret; 43 | #if _USE_MUTEX 44 | 45 | #if (osCMSIS < 0x20000U) 46 | osMutexDef(MTX); 47 | *sobj = osMutexCreate(osMutex(MTX)); 48 | #else 49 | *sobj = osMutexNew(NULL); 50 | #endif 51 | 52 | #else 53 | 54 | #if (osCMSIS < 0x20000U) 55 | osSemaphoreDef(SEM); 56 | *sobj = osSemaphoreCreate(osSemaphore(SEM), 1); 57 | #else 58 | *sobj = osSemaphoreNew(1, 1, NULL); 59 | #endif 60 | 61 | #endif 62 | ret = (*sobj != NULL); 63 | 64 | return ret; 65 | } 66 | 67 | 68 | 69 | /*------------------------------------------------------------------------*/ 70 | /* Delete a Synchronization Object */ 71 | /*------------------------------------------------------------------------*/ 72 | /* This function is called in f_mount() function to delete a synchronization 73 | / object that created with ff_cre_syncobj() function. When a 0 is returned, 74 | / the f_mount() function fails with FR_INT_ERR. 75 | */ 76 | 77 | int ff_del_syncobj ( /* 1:Function succeeded, 0:Could not delete due to any error */ 78 | _SYNC_t sobj /* Sync object tied to the logical drive to be deleted */ 79 | ) 80 | { 81 | #if _USE_MUTEX 82 | osMutexDelete (sobj); 83 | #else 84 | osSemaphoreDelete (sobj); 85 | #endif 86 | return 1; 87 | } 88 | 89 | 90 | 91 | /*------------------------------------------------------------------------*/ 92 | /* Request Grant to Access the Volume */ 93 | /*------------------------------------------------------------------------*/ 94 | /* This function is called on entering file functions to lock the volume. 95 | / When a 0 is returned, the file function fails with FR_TIMEOUT. 96 | */ 97 | 98 | int ff_req_grant ( /* 1:Got a grant to access the volume, 0:Could not get a grant */ 99 | _SYNC_t sobj /* Sync object to wait */ 100 | ) 101 | { 102 | int ret = 0; 103 | #if (osCMSIS < 0x20000U) 104 | 105 | #if _USE_MUTEX 106 | if(osMutexWait(sobj, _FS_TIMEOUT) == osOK) 107 | #else 108 | if(osSemaphoreWait(sobj, _FS_TIMEOUT) == osOK) 109 | #endif 110 | 111 | #else 112 | 113 | #if _USE_MUTEX 114 | if(osMutexAcquire(sobj, _FS_TIMEOUT) == osOK) 115 | #else 116 | if(osSemaphoreAcquire(sobj, _FS_TIMEOUT) == osOK) 117 | #endif 118 | 119 | #endif 120 | { 121 | ret = 1; 122 | } 123 | 124 | return ret; 125 | } 126 | 127 | 128 | 129 | /*------------------------------------------------------------------------*/ 130 | /* Release Grant to Access the Volume */ 131 | /*------------------------------------------------------------------------*/ 132 | /* This function is called on leaving file functions to unlock the volume. 133 | */ 134 | 135 | void ff_rel_grant ( 136 | _SYNC_t sobj /* Sync object to be signaled */ 137 | ) 138 | { 139 | #if _USE_MUTEX 140 | osMutexRelease(sobj); 141 | #else 142 | osSemaphoreRelease(sobj); 143 | #endif 144 | } 145 | 146 | #endif 147 | 148 | 149 | 150 | 151 | #if _USE_LFN == 3 /* LFN with a working buffer on the heap */ 152 | /*------------------------------------------------------------------------*/ 153 | /* Allocate a memory block */ 154 | /*------------------------------------------------------------------------*/ 155 | /* If a NULL is returned, the file function fails with FR_NOT_ENOUGH_CORE. 156 | */ 157 | 158 | void* ff_memalloc ( /* Returns pointer to the allocated memory block */ 159 | UINT msize /* Number of bytes to allocate */ 160 | ) 161 | { 162 | return ff_malloc(msize); /* Allocate a new memory block with POSIX API */ 163 | } 164 | 165 | 166 | /*------------------------------------------------------------------------*/ 167 | /* Free a memory block */ 168 | /*------------------------------------------------------------------------*/ 169 | 170 | void ff_memfree ( 171 | void* mblock /* Pointer to the memory block to free */ 172 | ) 173 | { 174 | ff_free(mblock); /* Discard the memory block with POSIX API */ 175 | } 176 | 177 | #endif 178 | -------------------------------------------------------------------------------- /source/STM32firmware/PlusCart/.settings/language.settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | -------------------------------------------------------------------------------- /source/STM32firmware/PlusCart/Src/cartridge_setup.c: -------------------------------------------------------------------------------- 1 | /* 2 | * cartridge_setup.c 3 | * 4 | * Created on: 05.07.2020 5 | * Author: stubig 6 | */ 7 | 8 | #include "global.h" 9 | #if USE_WIFI 10 | #include "esp8266.h" 11 | #endif 12 | #if USE_SD_CARD 13 | #include "fatfs.h" 14 | #endif 15 | #include "flash.h" 16 | #include "main.h" 17 | 18 | #include "cartridge_setup.h" 19 | 20 | #define FLASH_SIZE_KB 352 21 | 22 | #define RAM_IMAGE_SIZE (BUFFER_SIZE * 1024U) // 98304 23 | 24 | #define CCM_IMAGE_OFFSET RAM_IMAGE_SIZE // 98304 25 | #define CCM_IMAGE_SIZE (CCM_RAM_SIZE * 1024U) // 65536 26 | 27 | #define FLASH_IMAGE_OFFSET (RAM_IMAGE_SIZE + CCM_IMAGE_SIZE) 28 | #define FLASH_IMAGE_SIZE (FLASH_SIZE_KB * 1024U) 29 | 30 | 31 | 32 | bool setup_cartridge_image(const char* filename, uint32_t image_size, uint8_t* buffer, cartridge_layout* layout, MENU_ENTRY *d, enum cart_base_type banking_type) { 33 | uint32_t bank_size = 4096; 34 | 35 | switch(banking_type){ 36 | case(base_type_SB): 37 | if (image_size > 256*1024) return false; 38 | break; 39 | case(base_type_DF): 40 | case(base_type_DFSC): 41 | if (image_size != 128*1024) return false; 42 | break; 43 | case(base_type_BF): 44 | case(base_type_BFSC): 45 | if (image_size != 256*1024) return false; 46 | break; 47 | case base_type_3F: 48 | if (image_size > 512*1024) return false; 49 | bank_size = 2048; 50 | break; 51 | // these base types will never appear here, it is just to stop 52 | // the compiler from nagging! 53 | case base_type_None: 54 | case base_type_2K: 55 | case base_type_4K: 56 | case base_type_4KSC: 57 | case base_type_F8: 58 | case base_type_F6: 59 | case base_type_F4: 60 | case base_type_UA: 61 | case base_type_FE: 62 | case base_type_3E: 63 | case base_type_E0: 64 | case base_type_0840: 65 | case base_type_CV: 66 | case base_type_EF: 67 | case base_type_F0: 68 | case base_type_FA: 69 | case base_type_FA2: 70 | case base_type_E7: 71 | case base_type_DPC: 72 | case base_type_AR: 73 | case base_type_PP: 74 | case base_type_3EPlus: 75 | case base_type_DPCplus: 76 | case base_type_ACE: 77 | case base_type_ELF: 78 | case base_type_Load_Failed: 79 | default: 80 | return false; 81 | } 82 | 83 | 84 | uint32_t ram_size = image_size > (RAM_IMAGE_SIZE) ? RAM_IMAGE_SIZE : image_size; 85 | uint8_t ram_banks = (uint8_t)(ram_size / bank_size); 86 | 87 | for (uint8_t i = 0; i < ram_banks; i++) layout->banks[i] = buffer + i * bank_size; 88 | 89 | // Save d->type from CCMRAM before it is overwritten 90 | enum MENU_ENTRY_Type d_type = d->type; 91 | 92 | if(image_size > (RAM_IMAGE_SIZE + CCM_IMAGE_SIZE) ){ 93 | uint32_t flash_part_address; 94 | uint32_t flash_size = image_size - (RAM_IMAGE_SIZE + CCM_IMAGE_SIZE); 95 | uint8_t flash_banks = (uint8_t)(flash_size / bank_size); // should always be less than 352K 88 banks 96 | if(d_type == Cart_File ){ 97 | #if USE_WIFI 98 | flash_part_address = flash_download((char*)filename, flash_size, FLASH_IMAGE_OFFSET, true); 99 | #else 100 | flash_part_address = 0; // d->type == Cart_File and no WiFi ??? 101 | #endif 102 | }else if(d_type == SD_Cart_File ){ 103 | #if USE_SD_CARD 104 | flash_part_address = DOWNLOAD_AREA_START_ADDRESS + 128U * 1024U * (uint8_t)( user_settings.first_free_flash_sector - 5); 105 | uint32_t bytes_read = 0, next_read = 0; 106 | uint32_t next_chunk = flash_size > CCM_IMAGE_SIZE ? CCM_IMAGE_SIZE : flash_size; 107 | flash_erase_storage(user_settings.first_free_flash_sector); 108 | 109 | while ( bytes_read < flash_size){ 110 | next_read = sd_card_file_request( CCM_RAM, (char*) filename, FLASH_IMAGE_OFFSET + bytes_read, next_chunk ); 111 | flash_buffer_at(CCM_RAM, next_chunk, (uint8_t*)flash_part_address + bytes_read); 112 | bytes_read += next_read; 113 | next_chunk = flash_size > bytes_read + CCM_IMAGE_SIZE ? CCM_IMAGE_SIZE : flash_size - bytes_read; 114 | } 115 | #else 116 | flash_part_address = 0; // d->type == SD_Cart_File and no SD-Card ??? 117 | #endif 118 | }else{ 119 | flash_part_address = d->flash_base_address + FLASH_IMAGE_OFFSET; 120 | } 121 | 122 | if(flash_part_address == 0) 123 | return false; 124 | 125 | for (uint8_t i = 0; i < flash_banks; i++) layout->banks[((RAM_IMAGE_SIZE + CCM_IMAGE_SIZE) / bank_size) + i] = (uint8_t *)(flash_part_address + i * bank_size); 126 | } 127 | 128 | if(image_size > RAM_IMAGE_SIZE){ 129 | uint32_t bytes_read; 130 | uint32_t ccm_size = image_size > (RAM_IMAGE_SIZE + CCM_IMAGE_SIZE) ? CCM_IMAGE_SIZE : (image_size - RAM_IMAGE_SIZE); 131 | uint8_t ccm_banks = (uint8_t)(ccm_size / bank_size); 132 | if(d_type == Cart_File ){ 133 | #if USE_WIFI 134 | bytes_read = esp8266_PlusStore_API_file_request( CCM_RAM, (char*) filename, CCM_IMAGE_OFFSET, ccm_size ); 135 | #else 136 | bytes_read = 0; // d->type == Cart_File and no WiFi ??? 137 | #endif 138 | } 139 | else if(d_type == SD_Cart_File ){ 140 | #if USE_SD_CARD 141 | bytes_read = sd_card_file_request( CCM_RAM, (char*) filename, CCM_IMAGE_OFFSET, ccm_size ); 142 | #else 143 | bytes_read = 0; // d->type == SD_Cart_File and no SD-Card ??? 144 | #endif 145 | 146 | } 147 | else 148 | bytes_read = flash_file_request( CCM_RAM, d->flash_base_address, CCM_IMAGE_OFFSET, ccm_size ); 149 | 150 | if (bytes_read != ccm_size) return false; 151 | 152 | for (uint8_t i = 0; i < ccm_banks; i++) layout->banks[(RAM_IMAGE_SIZE / bank_size) + i] = CCM_RAM + i * bank_size; 153 | } 154 | 155 | return true; 156 | } 157 | 158 | -------------------------------------------------------------------------------- /source/STM32firmware/PlusCart/Src/stm32f4xx_it.c: -------------------------------------------------------------------------------- 1 | /* USER CODE BEGIN Header */ 2 | /** 3 | ****************************************************************************** 4 | * @file stm32f4xx_it.c 5 | * @brief Interrupt Service Routines. 6 | ****************************************************************************** 7 | * @attention 8 | * 9 | *

© Copyright (c) 2019 STMicroelectronics. 10 | * All rights reserved.

11 | * 12 | * This software component is licensed by ST under BSD 3-Clause license, 13 | * the "License"; You may not use this file except in compliance with the 14 | * License. You may obtain a copy of the License at: 15 | * opensource.org/licenses/BSD-3-Clause 16 | * 17 | ****************************************************************************** 18 | */ 19 | /* USER CODE END Header */ 20 | 21 | /* Includes ------------------------------------------------------------------*/ 22 | #include "main.h" 23 | #include "stm32f4xx_it.h" 24 | /* Private includes ----------------------------------------------------------*/ 25 | /* USER CODE BEGIN Includes */ 26 | /* USER CODE END Includes */ 27 | 28 | /* Private typedef -----------------------------------------------------------*/ 29 | /* USER CODE BEGIN TD */ 30 | 31 | /* USER CODE END TD */ 32 | 33 | /* Private define ------------------------------------------------------------*/ 34 | /* USER CODE BEGIN PD */ 35 | 36 | /* USER CODE END PD */ 37 | 38 | /* Private macro -------------------------------------------------------------*/ 39 | /* USER CODE BEGIN PM */ 40 | 41 | /* USER CODE END PM */ 42 | 43 | /* Private variables ---------------------------------------------------------*/ 44 | /* USER CODE BEGIN PV */ 45 | 46 | /* USER CODE END PV */ 47 | 48 | /* Private function prototypes -----------------------------------------------*/ 49 | /* USER CODE BEGIN PFP */ 50 | 51 | /* USER CODE END PFP */ 52 | 53 | /* Private user code ---------------------------------------------------------*/ 54 | /* USER CODE BEGIN 0 */ 55 | 56 | /* USER CODE END 0 */ 57 | 58 | /* External variables --------------------------------------------------------*/ 59 | 60 | /* USER CODE BEGIN EV */ 61 | 62 | /* USER CODE END EV */ 63 | 64 | /******************************************************************************/ 65 | /* Cortex-M4 Processor Interruption and Exception Handlers */ 66 | /******************************************************************************/ 67 | /** 68 | * @brief This function handles Non maskable interrupt. 69 | */ 70 | void NMI_Handler(void) 71 | { 72 | /* USER CODE BEGIN NonMaskableInt_IRQn 0 */ 73 | 74 | /* USER CODE END NonMaskableInt_IRQn 0 */ 75 | /* USER CODE BEGIN NonMaskableInt_IRQn 1 */ 76 | 77 | /* USER CODE END NonMaskableInt_IRQn 1 */ 78 | } 79 | 80 | /** 81 | * @brief This function handles Hard fault interrupt. 82 | */ 83 | void HardFault_Handler(void) 84 | { 85 | /* USER CODE BEGIN HardFault_IRQn 0 */ 86 | 87 | /* USER CODE END HardFault_IRQn 0 */ 88 | while (1) 89 | { 90 | /* USER CODE BEGIN W1_HardFault_IRQn 0 */ 91 | /* USER CODE END W1_HardFault_IRQn 0 */ 92 | } 93 | } 94 | 95 | /** 96 | * @brief This function handles Memory management fault. 97 | */ 98 | void MemManage_Handler(void) 99 | { 100 | /* USER CODE BEGIN MemoryManagement_IRQn 0 */ 101 | 102 | /* USER CODE END MemoryManagement_IRQn 0 */ 103 | while (1) 104 | { 105 | /* USER CODE BEGIN W1_MemoryManagement_IRQn 0 */ 106 | /* USER CODE END W1_MemoryManagement_IRQn 0 */ 107 | } 108 | } 109 | 110 | /** 111 | * @brief This function handles Pre-fetch fault, memory access fault. 112 | */ 113 | void BusFault_Handler(void) 114 | { 115 | /* USER CODE BEGIN BusFault_IRQn 0 */ 116 | 117 | /* USER CODE END BusFault_IRQn 0 */ 118 | while (1) 119 | { 120 | /* USER CODE BEGIN W1_BusFault_IRQn 0 */ 121 | /* USER CODE END W1_BusFault_IRQn 0 */ 122 | } 123 | } 124 | 125 | /** 126 | * @brief This function handles Undefined instruction or illegal state. 127 | */ 128 | void UsageFault_Handler(void) 129 | { 130 | /* USER CODE BEGIN UsageFault_IRQn 0 */ 131 | 132 | /* USER CODE END UsageFault_IRQn 0 */ 133 | while (1) 134 | { 135 | /* USER CODE BEGIN W1_UsageFault_IRQn 0 */ 136 | /* USER CODE END W1_UsageFault_IRQn 0 */ 137 | } 138 | } 139 | 140 | /** 141 | * @brief This function handles System service call via SWI instruction. 142 | */ 143 | void SVC_Handler(void) 144 | { 145 | /* USER CODE BEGIN SVCall_IRQn 0 */ 146 | 147 | /* USER CODE END SVCall_IRQn 0 */ 148 | /* USER CODE BEGIN SVCall_IRQn 1 */ 149 | 150 | /* USER CODE END SVCall_IRQn 1 */ 151 | } 152 | 153 | /** 154 | * @brief This function handles Debug monitor. 155 | */ 156 | void DebugMon_Handler(void) 157 | { 158 | /* USER CODE BEGIN DebugMonitor_IRQn 0 */ 159 | 160 | /* USER CODE END DebugMonitor_IRQn 0 */ 161 | /* USER CODE BEGIN DebugMonitor_IRQn 1 */ 162 | 163 | /* USER CODE END DebugMonitor_IRQn 1 */ 164 | } 165 | 166 | /** 167 | * @brief This function handles Pendable request for system service. 168 | */ 169 | void PendSV_Handler(void) 170 | { 171 | /* USER CODE BEGIN PendSV_IRQn 0 */ 172 | 173 | /* USER CODE END PendSV_IRQn 0 */ 174 | /* USER CODE BEGIN PendSV_IRQn 1 */ 175 | 176 | /* USER CODE END PendSV_IRQn 1 */ 177 | } 178 | 179 | /** 180 | * @brief This function handles System tick timer. 181 | */ 182 | void SysTick_Handler(void) 183 | { 184 | /* USER CODE BEGIN SysTick_IRQn 0 */ 185 | 186 | /* USER CODE END SysTick_IRQn 0 */ 187 | HAL_IncTick(); 188 | /* USER CODE BEGIN SysTick_IRQn 1 */ 189 | 190 | /* USER CODE END SysTick_IRQn 1 */ 191 | } 192 | 193 | /******************************************************************************/ 194 | /* STM32F4xx Peripheral Interrupt Handlers */ 195 | /* Add here the Interrupt Handlers for the used peripherals. */ 196 | /* For the available peripheral interrupt handler names, */ 197 | /* please refer to the startup file (startup_stm32f4xx.s). */ 198 | /******************************************************************************/ 199 | 200 | /* USER CODE BEGIN 1 */ 201 | 202 | /* USER CODE END 1 */ 203 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 204 | --------------------------------------------------------------------------------