Advice on available targets lazarus / 77-Embedded ---------------------------------------------------------------------- leiradel · 2017-06-07 21:51 Hello, I'm the gw-libretro author, a libretro core that runs simulations of LCD handheld devices such as the Game & Watch games from Nintendo. The simulators are conversions from games written by MADrigal, whom provides me the Delphi projects and source code, and assets for the games. The conversion works via a Pascal to Lua transpiler, which does the bulk of the work. The Lua code is then run by the gw-libretro core. For reasons beyond the scope of this topic, I can't implement some functionalities such as savestates and network play (Penguin Land has a two-player competitive mode) with that setup. To remedy that, and to ease the conversion process, I'm thinking about compiling the Pascal source code using FPC to a CPU/OS which I can easily emulate. My main issue is actually with the OS. I don't want to emulate a Windows or Linux box (I'd be almost writing a Virtual Box app if I did), and the simulators don't need a RTOS. DOS would do, but I believe this target only works with a DOS extender, which means more complexity. I know there's an embedded target, but I don't know what exactly it is, which CPUs it supports, and how the final binary is produced. Could someone give me a hand here? I know it's not possible, but imagine if I could compile the source code to the Z80, and the final linked binary is just a binary blob which I can load at, say, 0x4000, and that expects that some routines exist in the 0-0x3fff range. I won't be using actual Delphi components, but will write versions of them just like I did for the existing gw-libretro, which have only the minimal functionality required to run the simulations. Thanks in advance, Andre ---------------------------------------------------------------------- leiradel · 2017-06-07 22:46 I took a look at the DOS port and it's huge memory model is very close to what I want. Unfortunately, I'm afraid the 1 MB limits are won't accommodate the simulators. I just wanted to give more perspective to readers as to what I'm looking for. ---------------------------------------------------------------------- HeavyUser · 2017-06-08 00:42 I'm sorry but I'm a bit confused. Are you looking to build an OS emulator or a hardware emulator or something along the lines of dosbox? In any case have you seen ultibo? a small kernel for arm rasberry Pi that supports network and threads (If I remember correctly). It does not emulate any hardware though. You could use that as your base. In any case I'm out of my comfort zone for this one. here is the developers announcement in this forum http://forum.lazarus.freepascal.org/index.php/topic,31364.0.html ---------------------------------------------------------------------- Thaddy · 2017-06-08 06:28 I have to check for AVR and others but for e.g. ARM (embedded), apart from generic armv5 and higher, these specific processors are supported: Supported Microcontroller types:   LPC810M021FN8,LPC811M001FDH16,LPC812M101FDH16,LPC812M101FD20   LPC812M101FDH20,LPC1110FD20,LPC1111FDH20_002,LPC1111FHN33_101   LPC1111FHN33_102,LPC1111FHN33_103,LPC1111FHN33_201,LPC1111FHN33_202   LPC1111FHN33_203,LPC1112FD20_102,LPC1112FDH20_102,LPC1112FDH28_102   LPC1112FHN33_101,LPC1112FHN33_102,LPC1112FHN33_103,LPC1112FHN33_201   LPC1112FHN24_202,LPC1112FHN33_202,LPC1112FHN33_203,LPC1112FHI33_202   LPC1112FHI33_203,LPC1113FHN33_201,LPC1113FHN33_202,LPC1113FHN33_203   LPC1113FHN33_301,LPC1113FHN33_302,LPC1113FHN33_303,LPC1113FBD48_301   LPC1113FBD48_302,LPC1113FBD48_303,LPC1114FDH28_102,LPC1114FN28_102   LPC1114FHN33_201,LPC1114FHN33_202,LPC1114FHN33_203,LPC1114FHN33_301   LPC1114FHN33_302,LPC1114FHN33_303,LPC1114FHN33_333,LPC1114FHI33_302   LPC1114FHI33_303,LPC1114FBD48_301,LPC1114FBD48_302,LPC1114FBD48_303   LPC1114FBD48_323,LPC1114FBD48_333,LPC1115FBD48_303,LPC11C12FBD48_301   LPC11C14FBD48_301,LPC11C22FBD48_301,LPC11C24FBD48_301   LPC11D14FBD100_302,LPC1224FBD48_101,LPC1224FBD48_121,LPC1224FBD64_101   LPC1224FBD64_121,LPC1225FBD48_301,LPC1225FBD48_321,LPC1225FBD64_301   LPC1225FBD64_321,LPC1226FBD48_301,LPC1226FBD64_301,LPC1227FBD48_301   LPC1227FBD64_301,LPC12D27FBD100_301,LPC1311FHN33,LPC1311FHN33_01   LPC1313FHN33,LPC1313FHN33_01,LPC1313FBD48,LPC1313FBD48_01,LPC1315FHN33   LPC1315FBD48,LPC1316FHN33,LPC1316FBD48,LPC1317FHN33,LPC1317FBD48   LPC1317FBD64,LPC1342FHN33,LPC1342FBD48,LPC1343FHN33,LPC1343FBD48   LPC1345FHN33,LPC1345FBD48,LPC1346FHN33,LPC1346FBD48,LPC1347FHN33   LPC1347FBD48,LPC1347FBD64,LPC2114,LPC2124,LPC2194,LPC1754,LPC1756   LPC1758,LPC1764,LPC1766,LPC1768,AT91SAM7S256,AT91SAM7SE256,AT91SAM7X 256   AT91SAM7XC256,STM32F030C6,STM32F030C8,STM32F030F4,STM32F030K6   STM32F030R8,STM32F050C4,STM32F050C6,STM32F050F4,STM32F050F6,STM32F05 0G4   STM32F050G6,STM32F050K4,STM32F050K6,STM32F051C4,STM32F051C6,STM32F05 1C8   STM32F051K4,STM32F051K6,STM32F051K8,STM32F051R4,STM32F051R6,STM32F05 1R8   STM32F100X4,STM32F100X6,STM32F100X8,STM32F100XB,STM32F100XC,STM32F10 0XD   STM32F100XE,STM32F101X4,STM32F101X6,STM32F101X8,STM32F101XB,STM32F10 1XC   STM32F101XD,STM32F101XE,STM32F101XF,STM32F101XG,STM32F102X4,STM32F10 2X6   STM32F102X8,STM32F102XB,STM32F103X4,STM32F103X6,STM32F103X8,STM32F10 3XB   STM32F103XC,STM32F103XD,STM32F103XE,STM32F103XF,STM32F103XG,STM32F10 7X8   STM32F107XB,STM32F107XC,STM32F105R8,STM32F105RB,STM32F105RC,STM32F10 5V8   STM32F105VB,STM32F105VC,STM32F107RB,STM32F107RC,STM32F107VB,STM32F10 7VC   STM32F401CB,STM32F401RB,STM32F401VB,STM32F401CC,STM32F401RC,STM32F40 1VC   DISCOVERYF401VC,STM32F401CD,STM32F401RD,STM32F401VD,STM32F401CE   STM32F401RE,NUCLEOF401RE,STM32F401VE,STM32F407VG,DISCOVERYF407VG   STM32F407IG,STM32F407ZG,STM32F407VE,STM32F407ZE,STM32F407IE,STM32F41 1CC   STM32F411RC,STM32F411VC,STM32F411CE,STM32F411RE,NUCLEOF411RE   STM32F411VE,DISCOVERYF411VE,STM32F429VG,STM32F429ZG,STM32F429IG   STM32F429VI,STM32F429ZI,DISCOVERYF429ZI,STM32F429II,STM32F429VE   STM32F429ZE,STM32F429IE,STM32F429BG,STM32F429BI,STM32F429BE,STM32F42 9NG   STM32F429NI,STM32F429NE,STM32F446MC,STM32F446RC,STM32F446VC,STM32F44 6ZC   STM32F446ME,STM32F446RE,NUCLEOF446RE,STM32F446VE,STM32F446ZE   STM32F745XE,STM32F745XG,STM32F746XE,STM32F746XG,STM32F756XE,STM32F75 6XG   LM3S1110,LM3S1133,LM3S1138,LM3S1150,LM3S1162,LM3S1165,LM3S1166,LM3S2 110   LM3S2139,LM3S6100,LM3S6110,LM3S1601,LM3S1608,LM3S1620,LM3S1635,LM3S1 636   LM3S1637,LM3S1651,LM3S2601,LM3S2608,LM3S2620,LM3S2637,LM3S2651,LM3S6 610   LM3S6611,LM3S6618,LM3S6633,LM3S6637,LM3S8630,LM3S1911,LM3S1918,LM3S1 937   LM3S1958,LM3S1960,LM3S1968,LM3S1969,LM3S2911,LM3S2918,LM3S2919,LM3S2 939   LM3S2948,LM3S2950,LM3S2965,LM3S6911,LM3S6918,LM3S6938,LM3S6950,LM3S6 952   LM3S6965,LM3S8930,LM3S8933,LM3S8938,LM3S8962,LM3S8970,LM3S8971,LM3S5 951   LM3S5956,LM3S1B21,LM3S2B93,LM3S5B91,LM3S9B81,LM3S9B90,LM3S9B92,LM3S9 B95   LM3S9B96,LM3S5D51,LM4F120H5,SC32442B,XMC4500X1024,XMC4500X768   XMC4502X768,XMC4504X512,ALLWINNER_A20,MK20DX128VFM5,MK20DX128VFT5   MK20DX128VLF5,MK20DX128VLH5,TEENSY30,MK20DX128VMP5,MK20DX32VFM5   MK20DX32VFT5,MK20DX32VLF5,MK20DX32VLH5,MK20DX32VMP5,MK20DX64VFM5   MK20DX64VFT5,MK20DX64VLF5,MK20DX64VLH5,MK20DX64VMP5,MK20DX128VLH7   MK20DX128VLK7,MK20DX128VLL7,MK20DX128VMC7,MK20DX256VLH7,MK20DX256VLK7   MK20DX256VLL7,MK20DX256VMC7,TEENSY31,TEENSY32,MK20DX64VLH7,MK20DX64V LK7   MK20DX64VMC7,MK22FN512CAP12,MK22FN512CBP12,MK22FN512VDC12   MK22FN512VLH12,MK22FN512VLL12,MK22FN512VMP12,FREEDOM_K22F   MK64FN1M0VDC12,MK64FN1M0VLL12,FREEDOM_K64F,MK64FN1M0VLQ12   MK64FN1M0VMD12,MK64FX512VDC12,MK64FX512VLL12,MK64FX512VLQ12   MK64FX512VMD12,ATSAM3X8E,ARDUINO_DUE,FLIP_N_CLICK,NRF51422_XXAA   NRF51422_XXAB,NRF51422_XXAC,NRF51822_XXAA,NRF51822_XXAB,NRF51822_XXAC   NRF52832_XXAA,NRF52840_XXAA,THUMB2_BARE ---------------------------------------------------------------------- leiradel · 2017-06-08 11:45 Quote from: HeavyUser on June 08, 2017, 02:42:54 amI'm sorry but I'm a bit confused. Are you looking to build an OS emulator or a hardware emulator or something along the lines of dosbox? In any case have you seen ultibo? a small kernel for arm rasberry Pi that supports network and threads (If I remember correctly). It does not emulate any hardware though. You could use that as your base. In any case I'm out of my comfort zone for this one. here is the developers announcement in this forum http://forum.lazarus.freepascal.org/index.php/topic,31364.0.html Since the simulator is converted to Lua, I'd have to serialize the entire Lua VM state to implement savestates and netplay (netplay uses savestates behind the scene.) Although there is a serialization library for Lua, I'd rather implement it differently. I'm not trying to simulate an entire machine, just the bare minimum which allows me to run the simulators. Imagine the machine as a console to run the simulators, and that each simulator would be a cartridge. I don't even have to simulate the LCD or the audio, I can abstract them from the machine as I/O ports i.e. Code: ASM  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i mov al, 5; 5 is the intro musicout 34, al; 35 is the port that starts playing soundsmov al, 17 ; 17 is the player at its initial positionout 35, al ; turn it onout 36, al ; turn it off If I manage to specify such a machine and have FPC generate code for its CPU, I can generate savestates by just writing the RAM contents of the simulated machine, along with the LCD state. ---------------------------------------------------------------------- leiradel · 2017-06-08 11:47 Quote from: Thaddy on June 08, 2017, 08:28:35 amI have to check for AVR and others but for e.g. ARM (embedded), apart from generic armv5 and higher, these specific processors are supported: Supported Microcontroller types: How is the memory model for the embedded target? I can use an existing ARM emulator, but I need to emulate at least some of the target machine to be able to use the binary produced by FPC. ---------------------------------------------------------------------- leiradel · 2017-06-08 12:04 Quote from: leiradel on June 08, 2017, 01:47:24 pmHow is the memory model for the embedded target? I can use an existing ARM emulator, but I need to emulate at least some of the target machine to be able to use the binary produced by FPC. I took a look at the Wiki page for the embedded target, and it looks more limiting than the DOS target in terms of memory. Is it possible to make FPC disregard these limits when linking the final binary, and pretend the hardware has more flash and SRAM? Will the CPUs be able to address more memory than the amount in the specs?