{"id":2249,"date":"2023-12-25T01:14:49","date_gmt":"2023-12-25T00:14:49","guid":{"rendered":"https:\/\/dlabi.cz\/?p=2249"},"modified":"2023-12-30T12:48:04","modified_gmt":"2023-12-30T11:48:04","slug":"flexicard","status":"publish","type":"post","link":"https:\/\/dlabi.cz\/en\/flexicard\/","title":{"rendered":"Flexi Card"},"content":{"rendered":"<div class=\"wp-block-media-text is-stacked-on-mobile\"><figure class=\"wp-block-media-text__media\"><img loading=\"lazy\" decoding=\"async\" width=\"1170\" height=\"686\" src=\"https:\/\/dlabi.cz\/data\/flexicard.jpg\" alt=\"\" class=\"wp-image-2317 size-full\" srcset=\"https:\/\/dlabi.cz\/data\/flexicard.jpg 1170w, https:\/\/dlabi.cz\/data\/flexicard-300x176.jpg 300w, https:\/\/dlabi.cz\/data\/flexicard-768x450.jpg 768w, https:\/\/dlabi.cz\/data\/flexicard-18x12.jpg 18w\" sizes=\"auto, (max-width: 1170px) 100vw, 1170px\" \/><\/figure><div class=\"wp-block-media-text__content\">\n<p>A multipurpose card that emulates ROM and RAM. The ROM content is loaded from the SD card, as well as single-part programs in machine code stored in the CAS format. Below I provide a complete guide on how to make own Flexi Card. <\/p>\n<\/div><\/div>\n\n\n\n<!--more-->\n\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading has-text-align-center\">Introduction<\/h2>\n\n\n\n<p>Flexi card (hereinafter FC) would probably never have been created if I had not come across the pages of Kernelcrash<sup data-fn=\"237cf410-ca37-4007-b729-295f447730b5\" class=\"fn\"><a href=\"#237cf410-ca37-4007-b729-295f447730b5\" id=\"237cf410-ca37-4007-b729-295f447730b5-link\">1<\/a><\/sup>, who inspired me with his projects and from which FC is based. Some parts of his code are used in my project without changes. I thank KernelCrash for not keeping his knowledge to himself, and for allowing me to draw on his experience. Therefore, I am also making this project available to others.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading has-text-align-center\">Hardware<\/h2>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"alignleft size-large is-resized\"><img decoding=\"async\" src=\"https:\/\/stm32-base.org\/assets\/img\/boards\/STM32F407VET6_STM32F4XX_M-2.jpg\" alt=\"\" style=\"width:396px;height:auto\"\/><\/figure>\n<\/div>\n\n\n<p>FC uses a Chinese development board DevEBox.<sup data-fn=\"6f974547-7f77-4b5d-845f-ee758f051c7c\" class=\"fn\"><a href=\"#6f974547-7f77-4b5d-845f-ee758f051c7c\" id=\"6f974547-7f77-4b5d-845f-ee758f051c7c-link\">2<\/a><\/sup>\u00a0The advantages of this board are its small size, low price<sup data-fn=\"3f9cb66a-6147-47a4-88ec-82f978abba80\" class=\"fn\"><a href=\"#3f9cb66a-6147-47a4-88ec-82f978abba80\" id=\"3f9cb66a-6147-47a4-88ec-82f978abba80-link\">3<\/a><\/sup>, the presence of a slot for a micro SD card. It has a large number of IO ports and, most importantly, and this is also the reason for choosing this processor, that most of its GPIO ports are 5V tolerant, which is essential for cooperation with TTL logic. It is also very easy to flash and contains a debug port. The heart of this board is the STM32F407 processor from the Arm Cortex-M4 family2. Specifically, the VET6 variant, which has 512 KB of Flash memory3. It goes without saying that the use of a development board is not essential for the project, if you are able to design your own PCB with a minimal circuitry of the processor plus the necessary components for the operation of the SD card. I chose a development board, which is more convenient for prototyping and contains everything necessary.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading has-text-align-center\">Pin wiring<\/h2>\n\n\n\n<p>The choice of pins used seems messy, but it should be pointed out that each pin in the STM serves several functions that are activated\/deactivated in software. So it depends what peripherals you want to use. <\/p>\n\n\n\n<div class=\"wp-block-group\"><div class=\"wp-block-group__inner-container is-layout-constrained wp-block-group-is-layout-constrained\">\n<div class=\"wp-block-columns is-layout-flex wp-container-core-columns-is-layout-9d6595d7 wp-block-columns-is-layout-flex\">\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\" style=\"flex-basis:100%\">\n<figure class=\"wp-block-table alignleft is-style-small\" style=\"font-size:8px;font-style:normal;font-weight:600\"><table><thead><tr><th><strong>Sord <\/strong><\/th><th><strong>GPIO pin<\/strong><\/th><\/tr><\/thead><tbody><tr><td>IOWR<\/td><td>PB0&nbsp;<\/td><\/tr><tr><td>IORD<\/td><td>PB1<\/td><\/tr><tr><td>RFSH<\/td><td>*PC1<\/td><\/tr><tr><td>WAIT<\/td><td>PC5<\/td><\/tr><tr><td>RST<\/td><td>PB10<\/td><\/tr><tr><td>MRD<\/td><td>PC3<\/td><\/tr><tr><td>MWR<\/td><td>PC2<\/td><\/tr><tr><td>ROMDS<\/td><td>PC13<\/td><\/tr><tr><td>ROM0<\/td><td>PC0<\/td><\/tr><tr><td>MRQ<\/td><td>PC4<\/td><\/tr><tr><td>CLK<\/td><td>*PC6<\/td><\/tr><tr><td>D0..D7<\/td><td>PD8-PD15<\/td><\/tr><tr><td>A0..A15<\/td><td>PE0-PE15<\/td><\/tr><\/tbody><\/table><figcaption class=\"wp-element-caption\">* marks pins not yet used in fw<\/figcaption><\/figure>\n\n\n\n<figure class=\"wp-block-table is-style-regular\" style=\"font-size:8px;font-style:normal;font-weight:600\"><table><tbody><tr><td class=\"has-text-align-center\" data-align=\"center\" colspan=\"2\"><strong>used by FLASH<\/strong><\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\">\/CS<\/td><td>PA15<\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\">MOSI&nbsp;<\/td><td>PB5<\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\">SCK<\/td><td>PB3<\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\">MISO<\/td><td>PB4<\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\" colspan=\"2\"><strong>used by SWD<\/strong><\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\">SWDIO<\/td><td>PA13<\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\">SWCLK<\/td><td>PA14<\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\">SWO<\/td><td>PB3 <\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\" colspan=\"2\"><strong>user LEDS<\/strong><\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\">LED1<\/td><td>PA1<\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\" colspan=\"2\"><strong>used by SD<\/strong><\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\">DAT2<\/td><td>PC10<\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\">DAT3<\/td><td>PC11<\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\">CMD<\/td><td>PD2<\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\">CLK<\/td><td>PC12<\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\">DAT0<\/td><td>PC8<\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\">DAT1<\/td><td>PC9<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p style=\"font-size:8px\"><strong>debugging output (not used in normal mode except PA1 for LED) PA0-PA3<\/strong><\/p>\n<\/div>\n\n\n\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\" style=\"flex-basis:100%\">\n<figure data-wp-context=\"{&quot;imageId&quot;:&quot;69e367d23eea6&quot;}\" data-wp-interactive=\"core\/image\" data-wp-key=\"69e367d23eea6\" class=\"wp-block-image size-full is-resized wp-lightbox-container\"><img loading=\"lazy\" decoding=\"async\" width=\"717\" height=\"556\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on--click=\"actions.showLightbox\" data-wp-on--load=\"callbacks.setButtonStyles\" data-wp-on-window--resize=\"callbacks.setButtonStyles\" src=\"https:\/\/dlabi.cz\/data\/usedpins_black_mini_front2.png\" alt=\"\" class=\"wp-image-2263\" style=\"width:506px;height:auto\" srcset=\"https:\/\/dlabi.cz\/data\/usedpins_black_mini_front2.png 717w, https:\/\/dlabi.cz\/data\/usedpins_black_mini_front2-300x233.png 300w, https:\/\/dlabi.cz\/data\/usedpins_black_mini_front2-15x12.png 15w\" sizes=\"auto, (max-width: 717px) 100vw, 717px\" \/><button\n\t\t\tclass=\"lightbox-trigger\"\n\t\t\ttype=\"button\"\n\t\t\taria-haspopup=\"dialog\"\n\t\t\taria-label=\"Enlarge\"\n\t\t\tdata-wp-init=\"callbacks.initTriggerButton\"\n\t\t\tdata-wp-on--click=\"actions.showLightbox\"\n\t\t\tdata-wp-style--right=\"state.imageButtonRight\"\n\t\t\tdata-wp-style--top=\"state.imageButtonTop\"\n\t\t>\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewbox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\" \/>\n\t\t\t<\/svg>\n\t\t<\/button><\/figure>\n<\/div>\n<\/div>\n<\/div><\/div>\n\n\n\n<blockquote class=\"wp-block-quote is-style-default is-layout-flow wp-block-quote-is-layout-flow\"><div class=\"wp-block-image\">\n<figure class=\"alignleft size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"839\" height=\"521\" src=\"https:\/\/dlabi.cz\/data\/pcb-edited-1.jpeg\" alt=\"\" class=\"wp-image-2359\" style=\"width:310px;height:auto\" srcset=\"https:\/\/dlabi.cz\/data\/pcb-edited-1.jpeg 839w, https:\/\/dlabi.cz\/data\/pcb-edited-1-300x186.jpeg 300w, https:\/\/dlabi.cz\/data\/pcb-edited-1-768x477.jpeg 768w, https:\/\/dlabi.cz\/data\/pcb-edited-1-18x12.jpeg 18w\" sizes=\"auto, (max-width: 839px) 100vw, 839px\" \/><\/figure>\n<\/div>\n\n\n<h3 class=\"wp-block-heading has-small-font-size\"><strong>Important:<br><em>The FC power supply can be implemented in several ways. For the final operation, the board is ready to use the Sord's power supply. However, if you need flash or connect the FC using the STLINK dongle, you must first disconnect JMP1, otherwise you may damage the FC or Sord!<\/em><\/strong><\/h3>\n<\/blockquote>\n\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading has-text-align-center\">Function<\/h2>\n\n\n\n<p>After reset or power on, the FC tests for the presence of the SD card. If the <strong>sordm5<\/strong>&nbsp; directory is found in the root, which is a kind of indicator that the SD card contains compatible programs, the presence of the <strong>menu.rom<\/strong> file in the root of the card is tested. If it is found, it is loaded at address 2000H (i.e. as a ROM cartridge) and run. This then shows the user the contents of the SD card and allows the user to select programs. Alternatively, if a file called <strong>debug.cas<\/strong>&nbsp; is found in the root, it is loaded into memory as well. I have often used this to debug z80 code.<\/p>\n\n\n\n<p>If any of this testing fails, FC goes into <strong>Basic &#8211; F + 32kB RAM<\/strong> and the SD card is not used.<\/p>\n\n\n\n<p>The program has a time-critical part written in arm assembler. This is the MREQ handler,<br>where we emulate RAM and ROM. The rest is written in C, which is easier to write, although I personally don't like it, so please excuse any nonsense in the code. That being said, without the SD card, the FC behaves like a 64KBF DIY card (I may redo it in the future to a slightly different mode), which in the modified Sord<sup data-fn=\"98bcd0bc-a686-4694-a492-84c7726f18b8\" class=\"fn\"><a href=\"#98bcd0bc-a686-4694-a492-84c7726f18b8\" id=\"98bcd0bc-a686-4694-a492-84c7726f18b8-link\">4<\/a><\/sup> allows you to reach up to 64kB of RAM by disabling the MONITOR ROM and the cartridge. In the unmodified Sord, of course, only 32kB. <strong>To prevent damage to the unmodified Sord, there is a ROM0 jumper on the FC which, when disconnected, prevents control of the ROM0 signal used to disable MONITOR ROM.<\/strong> The memory modes are controlled via port 30h as follows: <\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"1070\" height=\"1326\" src=\"https:\/\/dlabi.cz\/data\/IMG_0384.jpeg\" alt=\"\" class=\"wp-image-2396\" style=\"width:311px;height:auto\" srcset=\"https:\/\/dlabi.cz\/data\/IMG_0384.jpeg 1070w, https:\/\/dlabi.cz\/data\/IMG_0384-202x250.jpeg 202w, https:\/\/dlabi.cz\/data\/IMG_0384-768x952.jpeg 768w, https:\/\/dlabi.cz\/data\/IMG_0384-10x12.jpeg 10w\" sizes=\"auto, (max-width: 1070px) 100vw, 1070px\" \/><\/figure>\n<\/div>\n\n\n<p>If a falling edge is detected on MREQ, an interrupt is generated, in which it is determined by reading the MWR and MRD signals whether it is a read or write to RAM or ROM memory. The time required to start the interrupt service routine is about 83nS and lasts ~583nS at the maximum processor frequency.<br>Furthermore, it is determined according to the set memory mode whether the memory area is under the control of FC and whether it is a RAM type area in case of writing. Otherwise, the interrupt is quickly terminated to leave the processor time to the main thread.<\/p>\n\n\n\n<p>This is formed by an infinite loop, in which the state of the variable main_thread_cmd is tested, which indicates whether Sord requires something from the FC card (or vice versa). This variable is set in the interrupt activated by the falling edge on IOWR, which is initiated by writing a command to port 81h. Then, depending on the command, data is sent or read on port 80h. Currently, FC recognizes these commands:<\/p>\n\n\n\n<figure class=\"wp-block-table has-small-font-size\"><table><tbody><tr><td>0<\/td><td>BREAK&nbsp;<\/td><td>Breaks current command<\/td><\/tr><tr><td>1<\/td><td>GET_COUNT&nbsp;<\/td><td>Returns the file count<\/td><\/tr><tr><td>2<\/td><td>SET_INDEX<\/td><td>Sets pointer position on file number<\/td><\/tr><tr><td>3<\/td><td>GET_INDEX&nbsp;<\/td><td>Gets pointer position<\/td><\/tr><tr><td>4<\/td><td>NEXT_FILE<\/td><td>Increase pointer position by 1<\/td><\/tr><tr><td>5<\/td><td>PREV_FILE<\/td><td>Decrease pointer position by 1<\/td><\/tr><tr><td>6<\/td><td>FIRST_FILE<\/td><td>Resets pointer<\/td><\/tr><tr><td>7<\/td><td>GET_FILENAME<\/td><td>Reads filename at pointer position from buffer<\/td><\/tr><tr><td>8<\/td><td>LOAD_FILE<\/td><td>Loads file to memory<\/td><\/tr><tr><td>9<\/td><td>RESET_SORD<\/td><td>Not implemented yet<\/td><\/tr><tr><td>10<\/td><td>DIR_SORD<\/td><td>Dirs SD card to buffer<\/td><\/tr><tr><td>11<\/td><td>OFFSET_RAM_ON<\/td><td>Offsets FC ram region 7000-7FFF to 8000-8FFF<\/td><\/tr><tr><td>12<\/td><td>OFFSET_RAM_OFF<\/td><td>Disables FC ram offset<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>Program <strong>menu.rom<\/strong> is written in z80 assembler. The program provides a list of programs located on the SD card in a pageable menu. After the user selects a program <em><strong>cmd8<\/strong><\/em>\u00a0 is used to load the selected program into the RAM area. However, if the program is located in the area 7000-7fff, it is \u201c<em>covered<\/em>\u201d by the Sord's internal RAM. For these purposes <strong><em>cmd11<\/em><\/strong>&nbsp; is used, which can temporarily offset the \u201c<em>covered<\/em>\"  area by +1000h, i.e. to the area 8000-8fff. Then it is up to <strong>menu.rom<\/strong>\u00a0 to copy the data from here to the Sord's internal memory and then cancel the offset with <strong><em>cmd12<\/em><\/strong> .This trick is mainly used for the MSX programs, where the MSX bios is located in the area 7000-7fff<\/p>\n\n\n\n<p>Another task of the main loop is to test the RST signal. If its activity is detected, the duration of the press is recorded. If it is shorter than about 3s, only Sord is reset (FC does not react). If it is longer, FC is also reset. Another way to reset FC independently of Sord is to use the RST button under the SD slot.<\/p>\n\n\n\n<p>For communication of FC with SD card, the open source library FatFs is used.<sup data-fn=\"0346821f-1b2a-4d56-8d0f-ba2980fcffab\" class=\"fn\"><a href=\"#0346821f-1b2a-4d56-8d0f-ba2980fcffab\" id=\"0346821f-1b2a-4d56-8d0f-ba2980fcffab-link\">5<\/a><\/sup><\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading has-text-align-center\">Compilation<\/h2>\n\n\n\n<p>You will need the arm cross compiler. A description of how to get one for your platform is beyond the scope of this article. I use WSL, so the following description will use the Linux environment.<\/p>\n\n\n\n<p>Most Linux distributions will install it:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo apt install build-essential\nsudo apt install gcc-arm-none-eabi\nsudo apt install gdb-multiarch<\/code><\/pre>\n\n\n\n<p>Next, you will need the firmware package for the STM32F4DISCOVERY board from st.com.<br>It is called STSW-STM320686<sup data-fn=\"75b0f978-852f-4029-a8ae-65b36f27f23e\" class=\"fn\"><a href=\"#75b0f978-852f-4029-a8ae-65b36f27f23e\" id=\"75b0f978-852f-4029-a8ae-65b36f27f23e-link\">6<\/a><\/sup>, unzip it somewhere and set this directory in the Makefile in the STM_COMMON variable <strong>&nbsp;<\/strong>.<\/p>\n\n\n\n<p>Then you will need the Basic-F rom, copy it to the roms directory, rename it to basic-f.rom. If you want to run MSX, you will also need msx.rom. Once you have everything together, follow these steps to start the compilation.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>cd src\nmake<\/code><\/pre>\n\n\n\n<p>To compile <strong>menu.rom<\/strong> you will need the z80 cross compiler. I use <strong>pasmo<\/strong><sup data-fn=\"dc321bc3-f751-4953-b8ce-93c8af2553be\" class=\"fn\"><a href=\"#dc321bc3-f751-4953-b8ce-93c8af2553be\" id=\"dc321bc3-f751-4953-b8ce-93c8af2553be-link\">7<\/a><\/sup>which you can install using<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo apt install pasmo<\/code><\/pre>\n\n\n\n<p>And then you compile with the command<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>make menu<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading has-text-align-center\">Firmware flashing<\/h2>\n\n\n\n<p>There are basically two ways to flash. Either via the built-in USB port in <strong>DFU<\/strong> mode, which you switch the card to by switching the BOOT0 pin from GND to 3V3. Then you connect to your computer and flash using the <strong><em>dfu-util<\/em><\/strong><sup data-fn=\"dc838e96-8291-4d2e-ab2b-d726de57b084\" class=\"fn\"><a href=\"#dc838e96-8291-4d2e-ab2b-d726de57b084\" id=\"dc838e96-8291-4d2e-ab2b-d726de57b084-link\">8<\/a><\/sup> on Linux with the&nbsp;<code>make flash-dfu<\/code>&nbsp;command, or using the <strong>DfuSe Demo<\/strong> for Windows. In this case you will need your compiled code in dfu format. To create the dfu format you can use this utility: <strong>hex2dfu<\/strong><sup data-fn=\"9ea96f25-9549-4000-9280-04f055dbd7dd\" class=\"fn\"><a href=\"#9ea96f25-9549-4000-9280-04f055dbd7dd\" id=\"9ea96f25-9549-4000-9280-04f055dbd7dd-link\">9<\/a><\/sup>.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"alignleft size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"540\" height=\"540\" src=\"https:\/\/dlabi.cz\/data\/st-link-v2-debugger-programator-pro-stm8-a-stm32.webp\" alt=\"\" class=\"wp-image-2297\" style=\"width:268px;height:auto\"\/><figcaption class=\"wp-element-caption\">Original programmer<\/figcaption><\/figure>\n<\/div>\n\n<div class=\"wp-block-image\">\n<figure class=\"alignright size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"1333\" height=\"1000\" src=\"https:\/\/dlabi.cz\/data\/51tLcd3XDL.jpg\" alt=\"\" class=\"wp-image-2298\" style=\"width:214px;height:auto\" srcset=\"https:\/\/dlabi.cz\/data\/51tLcd3XDL.jpg 1333w, https:\/\/dlabi.cz\/data\/51tLcd3XDL-300x225.jpg 300w, https:\/\/dlabi.cz\/data\/51tLcd3XDL-768x576.jpg 768w, https:\/\/dlabi.cz\/data\/51tLcd3XDL-16x12.jpg 16w\" sizes=\"auto, (max-width: 1333px) 100vw, 1333px\" \/><figcaption class=\"wp-element-caption\">Chinese clone<\/figcaption><\/figure>\n<\/div>\n\n\n<p class=\"has-text-align-left\">The second way requires the STLINK programmer. In this case you don't need to switch BOOT0 at all, the programmer will do everything by itself. I used the Linux program <strong><em>st-flash<\/em><\/strong><sup data-fn=\"fa57c5ce-5e63-48af-8f8e-78d71ab85a26\" class=\"fn\"><a href=\"#fa57c5ce-5e63-48af-8f8e-78d71ab85a26\" id=\"fa57c5ce-5e63-48af-8f8e-78d71ab85a26-link\">10<\/a><\/sup>which you will run by command&nbsp;<code>make flash<\/code>.<\/p>\n\n\n\n<p><\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading has-text-align-center\">SD card preparation<\/h2>\n\n\n\n<p>Format the card to FAT32 format. KernelCrash recommends cards with small capacity, or at least format them to a smaller size, because they are then less problematic. I have been using a 4GB card without any problems during testing.<\/p>\n\n\n\n<p>Place&nbsp;<strong>menu.rom<\/strong>&nbsp;and optionally&nbsp;<strong>debug.cas<\/strong>&nbsp;in the root of the card. Create a directory here called&nbsp;<strong>sordm5<\/strong>&nbsp;and copy the files you want to run into it. Remember, however, that the sorting is not alphabetical, but according to the order in which you wrote them to the card. To properly recognize the programs, you need to adjust the extensions of the programs as follows:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>ROM<\/strong>&nbsp;or&nbsp;<strong>BIN<\/strong>: ROM cartridges<\/li>\n\n\n\n<li><strong>CAS<\/strong>: programs with autostart in machine code<\/li>\n\n\n\n<li><strong>MSX<\/strong>: MSX programs that run under MSX. They are stored in the classic CAS format.<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading has-text-align-center\">PCB fabrication<\/h2>\n\n\n\n<p>Well, it depends on where you want to make the board. I used <a href=\"https:\/\/cart.jlcpcb.com\/quote\/\" target=\"_blank\" rel=\"noreferrer noopener\">PCB Prototype &amp; PCB Fabrication Manufacturer &#8211; JLCPCB<\/a>, you just need to use the Gerber file from the repository from the <em><strong>pcb<\/strong><\/em> folder and set the desired board properties. The minimum number of boards is 5 pieces, but the service is quite cheap, considering how much trouble it saves you.<\/p>\n\n\n\n<figure class=\"wp-block-gallery has-nested-images columns-default is-cropped wp-block-gallery-1 is-layout-flex wp-block-gallery-is-layout-flex\">\n<figure data-wp-context=\"{&quot;imageId&quot;:&quot;69e367d240528&quot;}\" data-wp-interactive=\"core\/image\" data-wp-key=\"69e367d240528\" class=\"wp-block-image size-large wp-lightbox-container\"><img loading=\"lazy\" decoding=\"async\" width=\"2560\" height=\"1920\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on--click=\"actions.showLightbox\" data-wp-on--load=\"callbacks.setButtonStyles\" data-wp-on-window--resize=\"callbacks.setButtonStyles\" data-id=\"2341\" src=\"https:\/\/dlabi.cz\/data\/IMG_0360-scaled.jpeg\" alt=\"\" class=\"wp-image-2341\" srcset=\"https:\/\/dlabi.cz\/data\/IMG_0360-scaled.jpeg 2560w, https:\/\/dlabi.cz\/data\/IMG_0360-300x225.jpeg 300w, https:\/\/dlabi.cz\/data\/IMG_0360-768x576.jpeg 768w, https:\/\/dlabi.cz\/data\/IMG_0360-1536x1152.jpeg 1536w, https:\/\/dlabi.cz\/data\/IMG_0360-2048x1536.jpeg 2048w, https:\/\/dlabi.cz\/data\/IMG_0360-16x12.jpeg 16w\" sizes=\"auto, (max-width: 2560px) 100vw, 2560px\" \/><button\n\t\t\tclass=\"lightbox-trigger\"\n\t\t\ttype=\"button\"\n\t\t\taria-haspopup=\"dialog\"\n\t\t\taria-label=\"Enlarge\"\n\t\t\tdata-wp-init=\"callbacks.initTriggerButton\"\n\t\t\tdata-wp-on--click=\"actions.showLightbox\"\n\t\t\tdata-wp-style--right=\"state.imageButtonRight\"\n\t\t\tdata-wp-style--top=\"state.imageButtonTop\"\n\t\t>\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewbox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\" \/>\n\t\t\t<\/svg>\n\t\t<\/button><figcaption class=\"wp-element-caption\">v1<\/figcaption><\/figure>\n\n\n\n<figure data-wp-context=\"{&quot;imageId&quot;:&quot;69e367d240a89&quot;}\" data-wp-interactive=\"core\/image\" data-wp-key=\"69e367d240a89\" class=\"wp-block-image size-large wp-lightbox-container\"><img loading=\"lazy\" decoding=\"async\" width=\"2560\" height=\"1700\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on--click=\"actions.showLightbox\" data-wp-on--load=\"callbacks.setButtonStyles\" data-wp-on-window--resize=\"callbacks.setButtonStyles\" data-id=\"2340\" src=\"https:\/\/dlabi.cz\/data\/IMG_0375-scaled.jpeg\" alt=\"\" class=\"wp-image-2340\" srcset=\"https:\/\/dlabi.cz\/data\/IMG_0375-scaled.jpeg 2560w, https:\/\/dlabi.cz\/data\/IMG_0375-300x199.jpeg 300w, https:\/\/dlabi.cz\/data\/IMG_0375-768x510.jpeg 768w, https:\/\/dlabi.cz\/data\/IMG_0375-1536x1020.jpeg 1536w\" sizes=\"auto, (max-width: 2560px) 100vw, 2560px\" \/><button\n\t\t\tclass=\"lightbox-trigger\"\n\t\t\ttype=\"button\"\n\t\t\taria-haspopup=\"dialog\"\n\t\t\taria-label=\"Enlarge\"\n\t\t\tdata-wp-init=\"callbacks.initTriggerButton\"\n\t\t\tdata-wp-on--click=\"actions.showLightbox\"\n\t\t\tdata-wp-style--right=\"state.imageButtonRight\"\n\t\t\tdata-wp-style--top=\"state.imageButtonTop\"\n\t\t>\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewbox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\" \/>\n\t\t\t<\/svg>\n\t\t<\/button><figcaption class=\"wp-element-caption\">v2<\/figcaption><\/figure>\n<\/figure>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading has-text-align-center\">Conclusion<\/h2>\n\n\n\n<p>And that\u2019s it. You can find the source codes here <a href=\"https:\/\/github.com\/dlabi\/sordm5-flexicard.git\" data-type=\"link\" data-id=\"https:\/\/github.com\/dlabi\/sordm5-flexicard.git\" target=\"_blank\" rel=\"noreferrer noopener\">github.com\/dlabi\/sordm5-flexicard.git<\/a>. <\/p>\n\n\n\n<p>There are many ways to use the potential of the STM board, so there is room for improvement. So far, FC can do the basics. Maybe in the future I will change the functionality a bit, depending on how the current solution works (or not).<\/p>\n\n\n\n<p>If you would like me to elaborate or add something, write in the comments. And if you haven\u2019t seen it yet, there is also a pseudo advertisement for Flexi Card which I've created for fun :-)<\/p>\n\n\n\n<figure class=\"wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio\"><div class=\"wp-block-embed__wrapper\">\n<iframe loading=\"lazy\" title=\"Flexi Card - ROM and RAM emulation card for Sord M5\" width=\"680\" height=\"383\" src=\"https:\/\/www.youtube.com\/embed\/FMj4XphwY58?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" allowfullscreen><\/iframe>\n<\/div><\/figure>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n<ol class=\"wp-block-footnotes\"><li id=\"237cf410-ca37-4007-b729-295f447730b5\"><a href=\"https:\/\/www.Kernelcrash.com\" target=\"_blank\" rel=\"noreferrer noopener\">www.kernelcrash.com<\/a> <a href=\"#237cf410-ca37-4007-b729-295f447730b5-link\" aria-label=\"Jump to footnote reference 1\">\u21a9\ufe0e<\/a><\/li><li id=\"6f974547-7f77-4b5d-845f-ee758f051c7c\"><a href=\"https:\/\/stm32-base.org\/boards\/STM32F407VET6-STM32F4XX-M\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/stm32-base.org\/boards\/STM32F407VET6-STM32F4XX-M<\/a> <a href=\"#6f974547-7f77-4b5d-845f-ee758f051c7c-link\" aria-label=\"Jump to footnote reference 2\">\u21a9\ufe0e<\/a><\/li><li id=\"3f9cb66a-6147-47a4-88ec-82f978abba80\">nap\u0159. <a href=\"https:\/\/www.aliexpress.com\/item\/1005005124722843.html\">https:\/\/www.aliexpress.com\/item\/1005005124722843.html<\/a> <a href=\"#3f9cb66a-6147-47a4-88ec-82f978abba80-link\" aria-label=\"Jump to footnote reference 3\">\u21a9\ufe0e<\/a><\/li><li id=\"98bcd0bc-a686-4694-a492-84c7726f18b8\"><a href=\"https:\/\/dlabi.cz\/en\/programove-odepinani-monitor-rom-pro-sord-m5\/\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/dlabi.cz\/programove-odepinani-monitor-rom-pro-sord-m5\/<\/a> <a href=\"#98bcd0bc-a686-4694-a492-84c7726f18b8-link\" aria-label=\"Jump to footnote reference 4\">\u21a9\ufe0e<\/a><\/li><li id=\"0346821f-1b2a-4d56-8d0f-ba2980fcffab\"><a href=\"http:\/\/elm-chan.org\/fsw\/ff\/\" target=\"_blank\" rel=\"noreferrer noopener\">http:\/\/elm-chan.org\/fsw\/ff\/<\/a> <a href=\"#0346821f-1b2a-4d56-8d0f-ba2980fcffab-link\" aria-label=\"Jump to footnote reference 5\">\u21a9\ufe0e<\/a><\/li><li id=\"75b0f978-852f-4029-a8ae-65b36f27f23e\"><a href=\"https:\/\/www.st.com\/en\/embedded-software\/stsw-stm32068.html\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/www.st.com\/en\/embedded-software\/stsw-stm32068.html<\/a> <a href=\"#75b0f978-852f-4029-a8ae-65b36f27f23e-link\" aria-label=\"Jump to footnote reference 6\">\u21a9\ufe0e<\/a><\/li><li id=\"dc321bc3-f751-4953-b8ce-93c8af2553be\"><a href=\"https:\/\/pasmo.speccy.org\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/pasmo.speccy.org<\/a> <a href=\"#dc321bc3-f751-4953-b8ce-93c8af2553be-link\" aria-label=\"Jump to footnote reference 7\">\u21a9\ufe0e<\/a><\/li><li id=\"dc838e96-8291-4d2e-ab2b-d726de57b084\">sudo apt install dfu-utils <a href=\"#dc838e96-8291-4d2e-ab2b-d726de57b084-link\" aria-label=\"Jump to footnote reference 8\">\u21a9\ufe0e<\/a><\/li><li id=\"9ea96f25-9549-4000-9280-04f055dbd7dd\"><a href=\"https:\/\/github.com\/encedo\/hex2dfu\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/github.com\/encedo\/hex2dfu<\/a> <a href=\"#9ea96f25-9549-4000-9280-04f055dbd7dd-link\" aria-label=\"Jump to footnote reference 9\">\u21a9\ufe0e<\/a><\/li><li id=\"fa57c5ce-5e63-48af-8f8e-78d71ab85a26\">sudo apt install stlink-tools <a href=\"#fa57c5ce-5e63-48af-8f8e-78d71ab85a26-link\" aria-label=\"Jump to footnote reference 10\">\u21a9\ufe0e<\/a><\/li><\/ol>","protected":false},"excerpt":{"rendered":"<p>V\u00edceu\u010delov\u00e1 karta emuluj\u00edc\u00ed ROM a RAM. Obsah ROM je na\u010d\u00edt\u00e1n z SD karty, stejn\u011b tak jednod\u00edln\u00e9 programy ve strojov\u00e9m k\u00f3du ulo\u017een\u00e9 v CAS form\u00e1tu. N\u00ed\u017ee uv\u00e1d\u00edm kompletn\u00ed n\u00e1vod jak si Flexi Card vyrobit&#8230;. <\/p>\n<div class=\"read-more navbutton\"><a href=\"https:\/\/dlabi.cz\/en\/flexicard\/\">Read More<i class=\"fa fa-angle-double-right\"><\/i><\/a><\/div>","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":"[{\"content\":\"<a href=\\\"https:\/\/www.Kernelcrash.com\\\" target=\\\"_blank\\\" rel=\\\"noreferrer noopener\\\">www.kernelcrash.com<\/a>\",\"id\":\"237cf410-ca37-4007-b729-295f447730b5\"},{\"content\":\"<a href=\\\"https:\/\/stm32-base.org\/boards\/STM32F407VET6-STM32F4XX-M\\\" target=\\\"_blank\\\" rel=\\\"noreferrer noopener\\\">https:\/\/stm32-base.org\/boards\/STM32F407VET6-STM32F4XX-M<\/a>\",\"id\":\"6f974547-7f77-4b5d-845f-ee758f051c7c\"},{\"content\":\"nap\u0159. <a href=\\\"https:\/\/www.aliexpress.com\/item\/1005005124722843.html\\\">https:\/\/www.aliexpress.com\/item\/1005005124722843.html<\/a>\",\"id\":\"3f9cb66a-6147-47a4-88ec-82f978abba80\"},{\"content\":\"<a href=\\\"https:\/\/dlabi.cz\/programove-odepinani-monitor-rom-pro-sord-m5\/\\\" target=\\\"_blank\\\" rel=\\\"noreferrer noopener\\\">https:\/\/dlabi.cz\/programove-odepinani-monitor-rom-pro-sord-m5\/<\/a>\",\"id\":\"98bcd0bc-a686-4694-a492-84c7726f18b8\"},{\"content\":\"<a href=\\\"http:\/\/elm-chan.org\/fsw\/ff\/\\\" target=\\\"_blank\\\" rel=\\\"noreferrer noopener\\\">http:\/\/elm-chan.org\/fsw\/ff\/<\/a>\",\"id\":\"0346821f-1b2a-4d56-8d0f-ba2980fcffab\"},{\"content\":\"<a href=\\\"https:\/\/www.st.com\/en\/embedded-software\/stsw-stm32068.html\\\" target=\\\"_blank\\\" rel=\\\"noreferrer noopener\\\">https:\/\/www.st.com\/en\/embedded-software\/stsw-stm32068.html<\/a>\",\"id\":\"75b0f978-852f-4029-a8ae-65b36f27f23e\"},{\"content\":\"<a href=\\\"https:\/\/pasmo.speccy.org\\\" target=\\\"_blank\\\" rel=\\\"noreferrer noopener\\\">https:\/\/pasmo.speccy.org<\/a>\",\"id\":\"dc321bc3-f751-4953-b8ce-93c8af2553be\"},{\"content\":\"sudo apt install dfu-utils\",\"id\":\"dc838e96-8291-4d2e-ab2b-d726de57b084\"},{\"content\":\"<a href=\\\"https:\/\/github.com\/encedo\/hex2dfu\\\" target=\\\"_blank\\\" rel=\\\"noreferrer noopener\\\">https:\/\/github.com\/encedo\/hex2dfu<\/a>\",\"id\":\"9ea96f25-9549-4000-9280-04f055dbd7dd\"},{\"content\":\"sudo apt install stlink-tools\",\"id\":\"fa57c5ce-5e63-48af-8f8e-78d71ab85a26\"}]"},"categories":[18,91],"tags":[],"class_list":["post-2249","post","type-post","status-publish","format-standard","hentry","category-8bit","category-sord-m5"],"_links":{"self":[{"href":"https:\/\/dlabi.cz\/en\/wp-json\/wp\/v2\/posts\/2249","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/dlabi.cz\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/dlabi.cz\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/dlabi.cz\/en\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/dlabi.cz\/en\/wp-json\/wp\/v2\/comments?post=2249"}],"version-history":[{"count":62,"href":"https:\/\/dlabi.cz\/en\/wp-json\/wp\/v2\/posts\/2249\/revisions"}],"predecessor-version":[{"id":2397,"href":"https:\/\/dlabi.cz\/en\/wp-json\/wp\/v2\/posts\/2249\/revisions\/2397"}],"wp:attachment":[{"href":"https:\/\/dlabi.cz\/en\/wp-json\/wp\/v2\/media?parent=2249"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dlabi.cz\/en\/wp-json\/wp\/v2\/categories?post=2249"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dlabi.cz\/en\/wp-json\/wp\/v2\/tags?post=2249"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}