software/bios: rename commands to cmds and update with libs' names.
authorFlorent Kermarrec <florent@enjoy-digital.fr>
Mon, 18 May 2020 21:26:51 +0000 (23:26 +0200)
committerFlorent Kermarrec <florent@enjoy-digital.fr>
Mon, 18 May 2020 21:26:51 +0000 (23:26 +0200)
16 files changed:
litex/soc/software/bios/Makefile
litex/soc/software/bios/cmds/cmd_bios.c [new file with mode: 0644]
litex/soc/software/bios/cmds/cmd_boot.c [new file with mode: 0644]
litex/soc/software/bios/cmds/cmd_litedram.c [new file with mode: 0644]
litex/soc/software/bios/cmds/cmd_liteeth.c [new file with mode: 0644]
litex/soc/software/bios/cmds/cmd_litesdcard.c [new file with mode: 0644]
litex/soc/software/bios/cmds/cmd_mem.c [new file with mode: 0644]
litex/soc/software/bios/cmds/cmd_spiflash.c [new file with mode: 0644]
litex/soc/software/bios/command.h
litex/soc/software/bios/commands/cmd_bios.c [deleted file]
litex/soc/software/bios/commands/cmd_boot.c [deleted file]
litex/soc/software/bios/commands/cmd_litedram.c [deleted file]
litex/soc/software/bios/commands/cmd_liteeth.c [deleted file]
litex/soc/software/bios/commands/cmd_litesdcard.c [deleted file]
litex/soc/software/bios/commands/cmd_mem.c [deleted file]
litex/soc/software/bios/commands/cmd_spiflash.c [deleted file]

index a4c39660c5981d63ae0a71df46315d7759d9bc1f..0e288a43bc3c59a239850e0c953db064210114ce 100755 (executable)
@@ -85,7 +85,7 @@ endif
 %.o: $(BIOS_DIRECTORY)/%.c
        $(compile)
 
-%.o: $(BIOS_DIRECTORY)/commands/%.c
+%.o: $(BIOS_DIRECTORY)/cmds/%.c
        $(compile)
 
 %.o: $(BIOS_DIRECTORY)/%.S
diff --git a/litex/soc/software/bios/cmds/cmd_bios.c b/litex/soc/software/bios/cmds/cmd_bios.c
new file mode 100644 (file)
index 0000000..bbca856
--- /dev/null
@@ -0,0 +1,147 @@
+// SPDX-License-Identifier: BSD-Source-Code
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include <id.h>
+#include <generated/csr.h>
+#include <crc.h>
+#include <system.h>
+
+#include "../command.h"
+#include "../helpers.h"
+
+/**
+ * Command "help"
+ *
+ * Print a list of available commands with their help text
+ *
+ */
+static void help_handler(int nb_params, char **params)
+{
+       struct command_struct * const *cmd;
+       int i, not_empty;
+
+       puts("\nLiteX BIOS, available commands:\n");
+
+       for (i = 0; i < NB_OF_GROUPS; i++) {
+               not_empty = 0;
+               for (cmd = __bios_cmd_start; cmd != __bios_cmd_end; cmd++) {
+                       if ((*cmd)->group == i) {
+                               printf("%-16s - %s\n", (*cmd)->name, (*cmd)->help ? (*cmd)->help : "-");
+                               not_empty = 1;
+                       }
+               }
+               if (not_empty)
+                       printf("\n");
+       }
+}
+
+define_command(help, help_handler, "Print this help", MISC_CMDS);
+
+/**
+ * Command "ident"
+ *
+ * Identifier of the system
+ *
+ */
+static void ident_helper(int nb_params, char **params)
+{
+       char buffer[IDENT_SIZE];
+
+       get_ident(buffer);
+       printf("Ident: %s", *buffer ? buffer : "-");
+}
+
+define_command(ident, ident_helper, "Identifier of the system", SYSTEM_CMDS);
+
+/**
+ * Command "reboot"
+ *
+ * Reboot the system
+ *
+ */
+#ifdef CSR_CTRL_RESET_ADDR
+static void reboot(int nb_params, char **params)
+{
+       ctrl_reset_write(1);
+}
+
+define_command(reboot, reboot, "Reboot the system", SYSTEM_CMDS);
+#endif
+
+/**
+ * Command "uptime"
+ *
+ * Uptime of the system
+ *
+ */
+#ifdef CSR_TIMER0_UPTIME_CYCLES_ADDR
+static void uptime(int nb_params, char **params)
+{
+       unsigned long uptime;
+
+       timer0_uptime_latch_write(1);
+       uptime = timer0_uptime_cycles_read();
+       printf("Uptime: %ld sys_clk cycles / %ld seconds",
+               uptime,
+               uptime/CONFIG_CLOCK_FREQUENCY
+       );
+}
+
+define_command(uptime, uptime, "Uptime of the system since power-up", SYSTEM_CMDS);
+#endif
+
+/**
+ * Command "crc"
+ *
+ * Compute CRC32 over an address range
+ *
+ */
+static void crc(int nb_params, char **params)
+{
+       char *c;
+       unsigned int addr;
+       unsigned int length;
+
+       if (nb_params < 2) {
+               printf("crc <address> <length>");
+               return;
+       }
+
+       addr = strtoul(params[0], &c, 0);
+       if (*c != 0) {
+               printf("Incorrect address");
+               return;
+       }
+
+       length = strtoul(params[1], &c, 0);
+       if (*c != 0) {
+               printf("Incorrect length");
+               return;
+       }
+
+       printf("CRC32: %08x", crc32((unsigned char *)addr, length));
+}
+
+define_command(crc, crc, "Compute CRC32 of a part of the address space", MISC_CMDS);
+
+/**
+ * Command "flush_cpu_dcache"
+ *
+ * Flush CPU data cache
+ *
+ */
+
+define_command(flush_cpu_dcache, flush_cpu_dcache, "Flush CPU data cache", CACHE_CMDS);
+
+/**
+ * Command "flush_l2_cache"
+ *
+ * Flush L2 cache
+ *
+ */
+#ifdef CONFIG_L2_SIZE
+define_command(flush_l2_cache, flush_l2_cache, "Flush L2 cache", CACHE_CMDS);
+#endif
+
diff --git a/litex/soc/software/bios/cmds/cmd_boot.c b/litex/soc/software/bios/cmds/cmd_boot.c
new file mode 100644 (file)
index 0000000..c9cb8a1
--- /dev/null
@@ -0,0 +1,59 @@
+// SPDX-License-Identifier: BSD-Source-Code
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include <generated/csr.h>
+
+#include "../command.h"
+#include "../helpers.h"
+#include "../boot.h"
+
+/**
+ * Command "flashboot"
+ *
+ * Boot software from flash
+ *
+ */
+#ifdef FLASH_BOOT_ADDRESS
+define_command(flashboot, flashboot, "Boot from flash", BOOT_CMDS);
+#endif
+
+/**
+ * Command "romboot"
+ *
+ * Boot software from embedded rom
+ *
+ */
+#ifdef ROM_BOOT_ADDRESS
+define_command(romboot, romboot, "Boot from embedded rom", BOOT_CMDS);
+#endif
+
+/**
+ * Command "serialboot"
+ *
+ * Boot software from serial interface
+ *
+ */
+define_command(serialboot, serialboot, "Boot via SFL", BOOT_CMDS);
+
+/**
+ * Command "netboot"
+ *
+ * Boot software from TFTP server
+ *
+ */
+#ifdef CSR_ETHMAC_BASE
+define_command(netboot, netboot, "Boot via TFTP", BOOT_CMDS);
+#endif
+
+/**
+ * Command "spisdcardboot"
+ *
+ * Boot software from SDcard
+ *
+ */
+#ifdef CSR_SPISDCARD_BASE
+define_command(spisdcardboot, spisdcardboot, "Boot from SDCard via SPI hardware bitbang", BOOT_CMDS);
+#endif
+
diff --git a/litex/soc/software/bios/cmds/cmd_litedram.c b/litex/soc/software/bios/cmds/cmd_litedram.c
new file mode 100644 (file)
index 0000000..0b9ea22
--- /dev/null
@@ -0,0 +1,223 @@
+// SPDX-License-Identifier: BSD-Source-Code
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include <generated/csr.h>
+
+#include "sdram.h"
+
+#include "../command.h"
+#include "../helpers.h"
+
+/**
+ * Command "sdrrow"
+ *
+ * Precharge/Activate row
+ *
+ */
+#ifdef CSR_SDRAM_BASE
+static void sdrrow_handler(int nb_params, char **params)
+{
+       char *c;
+       unsigned int row;
+
+       if (nb_params < 1) {
+               sdrrow(0);
+               printf("Precharged");
+       }
+
+       row = strtoul(params[0], &c, 0);
+       if (*c != 0) {
+               printf("Incorrect row");
+               return;
+       }
+
+       sdrrow(row);
+       printf("Activated row %d", row);
+}
+define_command(sdrrow, sdrrow_handler, "Precharge/Activate row", LITEDRAM_CMDS);
+#endif
+
+/**
+ * Command "sdrsw"
+ *
+ * Gives SDRAM control to SW
+ *
+ */
+#ifdef CSR_SDRAM_BASE
+define_command(sdrsw, sdrsw, "Gives SDRAM control to SW", LITEDRAM_CMDS);
+#endif
+
+/**
+ * Command "sdrhw"
+ *
+ * Gives SDRAM control to HW
+ *
+ */
+#ifdef CSR_SDRAM_BASE
+define_command(sdrhw, sdrhw, "Gives SDRAM control to HW", LITEDRAM_CMDS);
+#endif
+
+/**
+ * Command "sdrrdbuf"
+ *
+ * Dump SDRAM read buffer
+ *
+ */
+#ifdef CSR_SDRAM_BASE
+static void sdrrdbuf_handler(int nb_params, char **params)
+{
+       sdrrdbuf(-1);
+}
+
+define_command(sdrrdbuf, sdrrdbuf_handler, "Dump SDRAM read buffer", LITEDRAM_CMDS);
+#endif
+
+/**
+ * Command "sdrrd"
+ *
+ * Read SDRAM data
+ *
+ */
+#ifdef CSR_SDRAM_BASE
+static void sdrrd_handler(int nb_params, char **params)
+{
+       unsigned int addr;
+       int dq;
+       char *c;
+
+       if (nb_params < 1) {
+               printf("sdrrd <address>");
+               return;
+       }
+
+       addr = strtoul(params[0], &c, 0);
+       if (*c != 0) {
+               printf("Incorrect address");
+               return;
+       }
+
+       if (nb_params < 2)
+               dq = -1;
+       else {
+               dq = strtoul(params[1], &c, 0);
+               if (*c != 0) {
+                       printf("Incorrect DQ");
+                       return;
+               }
+       }
+
+       sdrrd(addr, dq);
+}
+
+define_command(sdrrd, sdrrd_handler, "Read SDRAM data", LITEDRAM_CMDS);
+#endif
+
+/**
+ * Command "sdrrderr"
+ *
+ * Print SDRAM read errors
+ *
+ */
+#ifdef CSR_SDRAM_BASE
+static void sdrrderr_handler(int nb_params, char **params)
+{
+       int count;
+       char *c;
+
+       if (nb_params < 1) {
+               printf("sdrrderr <count>");
+               return;
+       }
+
+       count = strtoul(params[0], &c, 0);
+       if (*c != 0) {
+               printf("Incorrect count");
+               return;
+       }
+
+       sdrrderr(count);
+}
+
+define_command(sdrrderr, sdrrderr_handler, "Print SDRAM read errors", LITEDRAM_CMDS);
+#endif
+
+/**
+ * Command "sdrwr"
+ *
+ * Write SDRAM test data
+ *
+ */
+#ifdef CSR_SDRAM_BASE
+static void sdrwr_handler(int nb_params, char **params)
+{
+       unsigned int addr;
+       char *c;
+
+       if (nb_params < 1) {
+               printf("sdrwr <address>");
+               return;
+       }
+
+       addr = strtoul(params[0], &c, 0);
+       if (*c != 0) {
+               printf("Incorrect address");
+               return;
+       }
+
+       sdrwr(addr);
+}
+
+define_command(sdrwr, sdrwr_handler, "Write SDRAM test data", LITEDRAM_CMDS);
+#endif
+
+/**
+ * Command "sdrinit"
+ *
+ * Start SDRAM initialisation
+ *
+ */
+#if defined(CSR_SDRAM_BASE) && defined(CSR_DDRPHY_BASE)
+define_command(sdrinit, sdrinit, "Start SDRAM initialisation", LITEDRAM_CMDS);
+#endif
+
+/**
+ * Command "sdrwlon"
+ *
+ * Write leveling ON
+ *
+ */
+#if defined(CSR_DDRPHY_BASE) && defined(SDRAM_PHY_WRITE_LEVELING_CAPABLE) && defined(CSR_SDRAM_BASE)
+define_command(sdrwlon, sdrwlon, "Enable write leveling", LITEDRAM_CMDS);
+#endif
+
+/**
+ * Command "sdrwloff"
+ *
+ * Write leveling OFF
+ *
+ */
+#if defined(CSR_DDRPHY_BASE) && defined(SDRAM_PHY_WRITE_LEVELING_CAPABLE) && defined(CSR_SDRAM_BASE)
+define_command(sdrwloff, sdrwloff, "Disable write leveling", LITEDRAM_CMDS);
+#endif
+
+/**
+ * Command "sdrlevel"
+ *
+ * Perform read/write leveling
+ *
+ */
+#if defined(CSR_DDRPHY_BASE) && defined(CSR_SDRAM_BASE)
+define_command(sdrlevel, sdrlevel, "Perform read/write leveling", LITEDRAM_CMDS);
+#endif
+
+/**
+ * Command "memtest"
+ *
+ * Run a memory test
+ *
+ */
+#ifdef CSR_SDRAM_BASE
+define_command(memtest, memtest, "Run a memory test", LITEDRAM_CMDS);
+#endif
diff --git a/litex/soc/software/bios/cmds/cmd_liteeth.c b/litex/soc/software/bios/cmds/cmd_liteeth.c
new file mode 100644 (file)
index 0000000..f9df1d2
--- /dev/null
@@ -0,0 +1,134 @@
+// SPDX-License-Identifier: BSD-Source-Code
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include <generated/csr.h>
+
+#include "mdio.h"
+
+#include "../command.h"
+#include "../helpers.h"
+
+/**
+ * Command "mdiow"
+ *
+ * Write MDIO register
+ *
+ */
+#ifdef CSR_ETHPHY_MDIO_W_ADDR
+static void mdiow(int nb_params, char **params)
+{
+       char *c;
+       unsigned int phyadr2;
+       unsigned int reg2;
+       unsigned int val2;
+
+       if (nb_params < 3) {
+               printf("mdiow <phyadr> <reg> <value>");
+               return;
+       }
+
+       phyadr2 = strtoul(params[0], &c, 0);
+       if (*c != 0) {
+               printf("Incorrect phyadr");
+               return;
+       }
+
+       reg2 = strtoul(params[1], &c, 0);
+       if (*c != 0) {
+               printf("Incorrect reg");
+               return;
+       }
+
+       val2 = strtoul(params[2], &c, 0);
+       if (*c != 0) {
+               printf("Incorrect val");
+               return;
+       }
+
+       mdio_write(phyadr2, reg2, val2);
+}
+
+define_command(mdiow, mdiow, "Write MDIO register", LITEETH_CMDS);
+#endif
+
+/**
+ * Command "mdior"
+ *
+ * Read MDIO register
+ *
+ */
+#ifdef CSR_ETHPHY_MDIO_W_ADDR
+static void mdior(int nb_params, char **params)
+{
+       char *c;
+       unsigned int phyadr2;
+       unsigned int reg2;
+       unsigned int val;
+
+       if (nb_params < 2) {
+               printf("mdior <phyadr> <reg>");
+               return;
+       }
+
+       phyadr2 = strtoul(params[0], &c, 0);
+       if (*c != 0) {
+               printf("Incorrect phyadr");
+               return;
+       }
+
+       reg2 = strtoul(params[1], &c, 0);
+       if (*c != 0) {
+               printf("Incorrect reg");
+               return;
+       }
+
+       val = mdio_read(phyadr2, reg2);
+       printf("Reg %d: 0x%04x", reg2, val);
+}
+
+define_command(mdior, mdior, "Read MDIO register", LITEETH_CMDS);
+#endif
+
+/**
+ * Command "mdiod"
+ *
+ * Dump MDIO registers
+ *
+ */
+#ifdef CSR_ETHPHY_MDIO_W_ADDR
+static void mdiod(int nb_params, char **params)
+{
+       char *c;
+       unsigned int phyadr;
+       unsigned int count;
+       unsigned int val;
+       int i;
+
+       if (nb_params < 2) {
+               printf("mdiod <phyadr> <count>");
+               return;
+       }
+
+       phyadr = strtoul(params[0], &c, 0);
+       if (*c != 0) {
+               printf("Incorrect phyadr");
+               return;
+       }
+
+       count = strtoul(params[1], &c, 0);
+       if (*c != 0) {
+               printf("Incorrect count");
+               return;
+       }
+
+       printf("MDIO dump @0x%x:\n", phyadr);
+       for (i = 0; i < count; i++) {
+               val = mdio_read(phyadr, i);
+               printf("reg %d: 0x%04x", i, val);
+       }
+}
+
+define_command(mdiod, mdiod, "Dump MDIO registers", LITEETH_CMDS);
+#endif
diff --git a/litex/soc/software/bios/cmds/cmd_litesdcard.c b/litex/soc/software/bios/cmds/cmd_litesdcard.c
new file mode 100644 (file)
index 0000000..d5d1651
--- /dev/null
@@ -0,0 +1,144 @@
+// SPDX-License-Identifier: BSD-Source-Code
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include <generated/csr.h>
+
+#include "sdcard.h"
+
+#include "../command.h"
+#include "../helpers.h"
+
+/**
+ * Command "sdclk"
+ *
+ * Configure SDcard clock frequency
+ *
+ */
+#ifdef CSR_SDCORE_BASE
+static void sdclk(int nb_params, char **params)
+{
+       unsigned int frequ;
+       char *c;
+
+       if (nb_params < 1) {
+               printf("sdclk <frequ>");
+               return;
+       }
+
+       frequ = strtoul(params[0], &c, 0);
+       if (*c != 0) {
+               printf("Incorrect frequency");
+               return;
+       }
+
+       sdclk_set_clk(frequ);
+}
+
+struct command_struct cmd_sdclk =
+{
+       .func = sdclk,
+       .name = "sdclk",
+       .help = "SDCard set clk frequency (Mhz)",
+};
+
+define_command(sdclk, sdclk, "SDCard set clk frequency (Mhz)", LITESDCARD_CMDS);
+#endif
+
+/**
+ * Command "sdinit"
+ *
+ * Initialize SDcard
+ *
+ */
+#ifdef CSR_SDCORE_BASE
+define_command(sdinit, sdcard_init, "SDCard initialization", LITESDCARD_CMDS);
+#endif
+
+/**
+ * Command "sdtest"
+ *
+ * Perform SDcard read/write tests
+ *
+ */
+#ifdef CSR_SDCORE_BASE
+static void sdtest(int nb_params, char **params)
+{
+       unsigned int blocks;
+       char *c;
+
+       if (nb_params < 1) {
+               printf("sdtest <number of blocks>");
+               return;
+       }
+
+       blocks = strtoul(params[0], &c, 0);
+       if (*c != 0) {
+               printf("Incorrect number of blocks to write");
+               return;
+       }
+
+       sdcard_test(blocks);
+}
+
+define_command(sdtest, sdtest, "SDCard test", LITESDCARD_CMDS);
+#endif
+
+/**
+ * Command "sdtestread"
+ *
+ * Perform SDcard read test
+ *
+ */
+#ifdef CSR_SDCORE_BASE
+static void sdtestread(int nb_params, char **params)
+{
+       unsigned int block;
+       char *c;
+
+       if (nb_params < 1) {
+               printf("sdtestread <block number>");
+               return;
+       }
+
+       block = strtoul(params[0], &c, 0);
+       if (*c != 0) {
+               printf("Incorrect number of block to read");
+               return;
+       }
+
+       sdcard_test_read(block);
+}
+
+define_command(sdtestread, sdtestread, "SDCard test read", LITESDCARD_CMDS);
+#endif
+
+/**
+ * Command "sdtestwrite"
+ *
+ * Perform SDcard write test
+ *
+ */
+#ifdef CSR_SDCORE_BASE
+static void sdtestwrite(int nb_params, char **params)
+{
+       unsigned int block;
+       char *c;
+
+       if (nb_params < 2) {
+               printf("sdtestread <block number> <str to write>");
+               return;
+       }
+
+       block = strtoul(params[0], &c, 0);
+       if (*c != 0) {
+               printf("Incorrect number of block to write");
+               return;
+       }
+
+       sdcard_test_write(block, params[1]);
+}
+
+define_command(sdtestwrite, sdtestwrite, "SDCard test write", LITESDCARD_CMDS);
+#endif
diff --git a/litex/soc/software/bios/cmds/cmd_mem.c b/litex/soc/software/bios/cmds/cmd_mem.c
new file mode 100644 (file)
index 0000000..8c63d4c
--- /dev/null
@@ -0,0 +1,137 @@
+// SPDX-License-Identifier: BSD-Source-Code
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "../command.h"
+#include "../helpers.h"
+
+/**
+ * Command "mr"
+ *
+ * Memory read
+ *
+ */
+static void mr(int nb_params, char **params)
+{
+       char *c;
+       unsigned int *addr;
+       unsigned int length;
+
+       if (nb_params < 1) {
+               printf("mr <address> [length]");
+               return;
+       }
+       addr = (unsigned int *)strtoul(params[0], &c, 0);
+       if (*c != 0) {
+               printf("Incorrect address");
+               return;
+       }
+       if (nb_params == 1) {
+               length = 4;
+       } else {
+               length = strtoul(params[1], &c, 0);
+               if(*c != 0) {
+                       printf("\nIncorrect length");
+                       return;
+               }
+       }
+
+       dump_bytes(addr, length, (unsigned long)addr);
+}
+
+define_command(mr, mr, "Read address space", MEM_CMDS);
+
+/**
+ * Command "mw"
+ *
+ * Memory write
+ *
+ */
+static void mw(int nb_params, char **params)
+{
+       char *c;
+       unsigned int *addr;
+       unsigned int value;
+       unsigned int count;
+       unsigned int i;
+
+       if (nb_params < 2) {
+               printf("mw <address> <value> [count]");
+               return;
+       }
+
+       addr = (unsigned int *)strtoul(params[0], &c, 0);
+       if (*c != 0) {
+               printf("Incorrect address");
+               return;
+       }
+
+       value = strtoul(params[1], &c, 0);
+       if(*c != 0) {
+               printf("Incorrect value");
+               return;
+       }
+
+       if (nb_params == 2) {
+               count = 1;
+       } else {
+               count = strtoul(params[2], &c, 0);
+               if(*c != 0) {
+                       printf("Incorrect count");
+                       return;
+               }
+       }
+
+       for (i = 0; i < count; i++)
+               *addr++ = value;
+}
+
+define_command(mw, mw, "Write address space", MEM_CMDS);
+
+/**
+ * Command "mc"
+ *
+ * Memory copy
+ *
+ */
+static void mc(int nb_params, char **params)
+{
+       char *c;
+       unsigned int *dstaddr;
+       unsigned int *srcaddr;
+       unsigned int count;
+       unsigned int i;
+
+       if (nb_params < 2) {
+               printf("mc <dst> <src> [count]");
+               return;
+       }
+
+       dstaddr = (unsigned int *)strtoul(params[0], &c, 0);
+       if (*c != 0) {
+               printf("Incorrect destination address");
+               return;
+       }
+
+       srcaddr = (unsigned int *)strtoul(params[1], &c, 0);
+       if (*c != 0) {
+               printf("Incorrect source address");
+               return;
+       }
+
+       if (nb_params == 2) {
+               count = 1;
+       } else {
+               count = strtoul(params[2], &c, 0);
+               if (*c != 0) {
+                       printf("Incorrect count");
+                       return;
+               }
+       }
+
+       for (i = 0; i < count; i++)
+               *dstaddr++ = *srcaddr++;
+}
+
+define_command(mc, mc, "Copy address space", MEM_CMDS);
diff --git a/litex/soc/software/bios/cmds/cmd_spiflash.c b/litex/soc/software/bios/cmds/cmd_spiflash.c
new file mode 100644 (file)
index 0000000..8ca18c8
--- /dev/null
@@ -0,0 +1,75 @@
+// SPDX-License-Identifier: BSD-Source-Code
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include <generated/csr.h>
+
+#include "../command.h"
+#include "../helpers.h"
+
+/**
+ * Command "fw"
+ *
+ * Write data from a memory buffer to SPI flash
+ *
+ */
+#if (defined CSR_SPIFLASH_BASE && defined SPIFLASH_PAGE_SIZE)
+static void fw(int nb_params, char **params)
+{
+       char *c;
+       unsigned int addr;
+       unsigned int value;
+       unsigned int count;
+       unsigned int i;
+
+       if (nb_params < 2) {
+               printf("fw <offset> <value> [count]");
+               return;
+       }
+
+       addr = strtoul(params[0], &c, 0);
+       if (*c != 0) {
+               printf("Incorrect offset");
+               return;
+       }
+
+       value = strtoul(params[1], &c, 0);
+       if (*c != 0) {
+               printf("Incorrect value");
+               return;
+       }
+
+       if (nb_params == 2) {
+               count = 1;
+       } else {
+               count = strtoul(params[2], &c, 0);
+               if (*c != 0) {
+                       printf("Incorrect count");
+                       return;
+               }
+       }
+
+       for (i = 0; i < count; i++)
+               write_to_flash(addr + i * 4, (unsigned char *)&value, 4);
+}
+
+define_command(fw, fw, "Write to flash", SPIFLASH_CMDS);
+#endif
+
+/**
+ * Command "fe"
+ *
+ * Flash erase
+ *
+ */
+#if (defined CSR_SPIFLASH_BASE && defined SPIFLASH_PAGE_SIZE)
+static void fe(int nb_params, char **params)
+{
+       erase_flash();
+       printf("Flash erased\n");
+}
+
+define_command(fe, fe, "Erase whole flash", SPIFLASH_CMDS);
+#endif
+
index 693d79825e6d4eb77308a055bbbf778ddb222624..1640231ff35b0164bb97eb753e1a34f62215b4c4 100644 (file)
@@ -9,17 +9,16 @@
 
 #define HIST_DEPTH     10      /* Used in string list, complete.c */
 
-#define MISC_CMDS      0
-#define SYSTEM_CMDS    1
-#define CACHE_CMDS     2
-#define BOOT_CMDS      3
-#define DRAM_CMDS      4
-#define MDIO_CMDS      5
-#define MEM_CMDS       6
-#define SD_CMDS                7
-#define SPIFLASH_CMDS  8
-#define DDR_CMDS       9
-#define NB_OF_GROUPS   10
+#define MISC_CMDS              0
+#define SYSTEM_CMDS            1
+#define CACHE_CMDS             2
+#define MEM_CMDS               3
+#define BOOT_CMDS              3
+#define SPIFLASH_CMDS  4
+#define LITEDRAM_CMDS  4
+#define LITEETH_CMDS   5
+#define LITESDCARD_CMDS        7
+#define NB_OF_GROUPS   8
 
 typedef void (*cmd_handler)(int nb_params, char **params);
 
diff --git a/litex/soc/software/bios/commands/cmd_bios.c b/litex/soc/software/bios/commands/cmd_bios.c
deleted file mode 100644 (file)
index bbca856..0000000
+++ /dev/null
@@ -1,147 +0,0 @@
-// SPDX-License-Identifier: BSD-Source-Code
-
-#include <stdio.h>
-#include <stdlib.h>
-
-#include <id.h>
-#include <generated/csr.h>
-#include <crc.h>
-#include <system.h>
-
-#include "../command.h"
-#include "../helpers.h"
-
-/**
- * Command "help"
- *
- * Print a list of available commands with their help text
- *
- */
-static void help_handler(int nb_params, char **params)
-{
-       struct command_struct * const *cmd;
-       int i, not_empty;
-
-       puts("\nLiteX BIOS, available commands:\n");
-
-       for (i = 0; i < NB_OF_GROUPS; i++) {
-               not_empty = 0;
-               for (cmd = __bios_cmd_start; cmd != __bios_cmd_end; cmd++) {
-                       if ((*cmd)->group == i) {
-                               printf("%-16s - %s\n", (*cmd)->name, (*cmd)->help ? (*cmd)->help : "-");
-                               not_empty = 1;
-                       }
-               }
-               if (not_empty)
-                       printf("\n");
-       }
-}
-
-define_command(help, help_handler, "Print this help", MISC_CMDS);
-
-/**
- * Command "ident"
- *
- * Identifier of the system
- *
- */
-static void ident_helper(int nb_params, char **params)
-{
-       char buffer[IDENT_SIZE];
-
-       get_ident(buffer);
-       printf("Ident: %s", *buffer ? buffer : "-");
-}
-
-define_command(ident, ident_helper, "Identifier of the system", SYSTEM_CMDS);
-
-/**
- * Command "reboot"
- *
- * Reboot the system
- *
- */
-#ifdef CSR_CTRL_RESET_ADDR
-static void reboot(int nb_params, char **params)
-{
-       ctrl_reset_write(1);
-}
-
-define_command(reboot, reboot, "Reboot the system", SYSTEM_CMDS);
-#endif
-
-/**
- * Command "uptime"
- *
- * Uptime of the system
- *
- */
-#ifdef CSR_TIMER0_UPTIME_CYCLES_ADDR
-static void uptime(int nb_params, char **params)
-{
-       unsigned long uptime;
-
-       timer0_uptime_latch_write(1);
-       uptime = timer0_uptime_cycles_read();
-       printf("Uptime: %ld sys_clk cycles / %ld seconds",
-               uptime,
-               uptime/CONFIG_CLOCK_FREQUENCY
-       );
-}
-
-define_command(uptime, uptime, "Uptime of the system since power-up", SYSTEM_CMDS);
-#endif
-
-/**
- * Command "crc"
- *
- * Compute CRC32 over an address range
- *
- */
-static void crc(int nb_params, char **params)
-{
-       char *c;
-       unsigned int addr;
-       unsigned int length;
-
-       if (nb_params < 2) {
-               printf("crc <address> <length>");
-               return;
-       }
-
-       addr = strtoul(params[0], &c, 0);
-       if (*c != 0) {
-               printf("Incorrect address");
-               return;
-       }
-
-       length = strtoul(params[1], &c, 0);
-       if (*c != 0) {
-               printf("Incorrect length");
-               return;
-       }
-
-       printf("CRC32: %08x", crc32((unsigned char *)addr, length));
-}
-
-define_command(crc, crc, "Compute CRC32 of a part of the address space", MISC_CMDS);
-
-/**
- * Command "flush_cpu_dcache"
- *
- * Flush CPU data cache
- *
- */
-
-define_command(flush_cpu_dcache, flush_cpu_dcache, "Flush CPU data cache", CACHE_CMDS);
-
-/**
- * Command "flush_l2_cache"
- *
- * Flush L2 cache
- *
- */
-#ifdef CONFIG_L2_SIZE
-define_command(flush_l2_cache, flush_l2_cache, "Flush L2 cache", CACHE_CMDS);
-#endif
-
diff --git a/litex/soc/software/bios/commands/cmd_boot.c b/litex/soc/software/bios/commands/cmd_boot.c
deleted file mode 100644 (file)
index c9cb8a1..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
-// SPDX-License-Identifier: BSD-Source-Code
-
-#include <stdio.h>
-#include <stdlib.h>
-
-#include <generated/csr.h>
-
-#include "../command.h"
-#include "../helpers.h"
-#include "../boot.h"
-
-/**
- * Command "flashboot"
- *
- * Boot software from flash
- *
- */
-#ifdef FLASH_BOOT_ADDRESS
-define_command(flashboot, flashboot, "Boot from flash", BOOT_CMDS);
-#endif
-
-/**
- * Command "romboot"
- *
- * Boot software from embedded rom
- *
- */
-#ifdef ROM_BOOT_ADDRESS
-define_command(romboot, romboot, "Boot from embedded rom", BOOT_CMDS);
-#endif
-
-/**
- * Command "serialboot"
- *
- * Boot software from serial interface
- *
- */
-define_command(serialboot, serialboot, "Boot via SFL", BOOT_CMDS);
-
-/**
- * Command "netboot"
- *
- * Boot software from TFTP server
- *
- */
-#ifdef CSR_ETHMAC_BASE
-define_command(netboot, netboot, "Boot via TFTP", BOOT_CMDS);
-#endif
-
-/**
- * Command "spisdcardboot"
- *
- * Boot software from SDcard
- *
- */
-#ifdef CSR_SPISDCARD_BASE
-define_command(spisdcardboot, spisdcardboot, "Boot from SDCard via SPI hardware bitbang", BOOT_CMDS);
-#endif
-
diff --git a/litex/soc/software/bios/commands/cmd_litedram.c b/litex/soc/software/bios/commands/cmd_litedram.c
deleted file mode 100644 (file)
index 0d05b25..0000000
+++ /dev/null
@@ -1,223 +0,0 @@
-// SPDX-License-Identifier: BSD-Source-Code
-
-#include <stdio.h>
-#include <stdlib.h>
-
-#include <generated/csr.h>
-
-#include "sdram.h"
-
-#include "../command.h"
-#include "../helpers.h"
-
-/**
- * Command "sdrrow"
- *
- * Precharge/Activate row
- *
- */
-#ifdef CSR_SDRAM_BASE
-static void sdrrow_handler(int nb_params, char **params)
-{
-       char *c;
-       unsigned int row;
-
-       if (nb_params < 1) {
-               sdrrow(0);
-               printf("Precharged");
-       }
-
-       row = strtoul(params[0], &c, 0);
-       if (*c != 0) {
-               printf("Incorrect row");
-               return;
-       }
-
-       sdrrow(row);
-       printf("Activated row %d", row);
-}
-define_command(sdrrow, sdrrow_handler, "Precharge/Activate row", DRAM_CMDS);
-#endif
-
-/**
- * Command "sdrsw"
- *
- * Gives SDRAM control to SW
- *
- */
-#ifdef CSR_SDRAM_BASE
-define_command(sdrsw, sdrsw, "Gives SDRAM control to SW", DRAM_CMDS);
-#endif
-
-/**
- * Command "sdrhw"
- *
- * Gives SDRAM control to HW
- *
- */
-#ifdef CSR_SDRAM_BASE
-define_command(sdrhw, sdrhw, "Gives SDRAM control to HW", DRAM_CMDS);
-#endif
-
-/**
- * Command "sdrrdbuf"
- *
- * Dump SDRAM read buffer
- *
- */
-#ifdef CSR_SDRAM_BASE
-static void sdrrdbuf_handler(int nb_params, char **params)
-{
-       sdrrdbuf(-1);
-}
-
-define_command(sdrrdbuf, sdrrdbuf_handler, "Dump SDRAM read buffer", DRAM_CMDS);
-#endif
-
-/**
- * Command "sdrrd"
- *
- * Read SDRAM data
- *
- */
-#ifdef CSR_SDRAM_BASE
-static void sdrrd_handler(int nb_params, char **params)
-{
-       unsigned int addr;
-       int dq;
-       char *c;
-
-       if (nb_params < 1) {
-               printf("sdrrd <address>");
-               return;
-       }
-
-       addr = strtoul(params[0], &c, 0);
-       if (*c != 0) {
-               printf("Incorrect address");
-               return;
-       }
-
-       if (nb_params < 2)
-               dq = -1;
-       else {
-               dq = strtoul(params[1], &c, 0);
-               if (*c != 0) {
-                       printf("Incorrect DQ");
-                       return;
-               }
-       }
-
-       sdrrd(addr, dq);
-}
-
-define_command(sdrrd, sdrrd_handler, "Read SDRAM data", DRAM_CMDS);
-#endif
-
-/**
- * Command "sdrrderr"
- *
- * Print SDRAM read errors
- *
- */
-#ifdef CSR_SDRAM_BASE
-static void sdrrderr_handler(int nb_params, char **params)
-{
-       int count;
-       char *c;
-
-       if (nb_params < 1) {
-               printf("sdrrderr <count>");
-               return;
-       }
-
-       count = strtoul(params[0], &c, 0);
-       if (*c != 0) {
-               printf("Incorrect count");
-               return;
-       }
-
-       sdrrderr(count);
-}
-
-define_command(sdrrderr, sdrrderr_handler, "Print SDRAM read errors", DRAM_CMDS);
-#endif
-
-/**
- * Command "sdrwr"
- *
- * Write SDRAM test data
- *
- */
-#ifdef CSR_SDRAM_BASE
-static void sdrwr_handler(int nb_params, char **params)
-{
-       unsigned int addr;
-       char *c;
-
-       if (nb_params < 1) {
-               printf("sdrwr <address>");
-               return;
-       }
-
-       addr = strtoul(params[0], &c, 0);
-       if (*c != 0) {
-               printf("Incorrect address");
-               return;
-       }
-
-       sdrwr(addr);
-}
-
-define_command(sdrwr, sdrwr_handler, "Write SDRAM test data", DRAM_CMDS);
-#endif
-
-/**
- * Command "sdrinit"
- *
- * Start SDRAM initialisation
- *
- */
-#if defined(CSR_SDRAM_BASE) && defined(CSR_DDRPHY_BASE)
-define_command(sdrinit, sdrinit, "Start SDRAM initialisation", DRAM_CMDS);
-#endif
-
-/**
- * Command "sdrwlon"
- *
- * Write leveling ON
- *
- */
-#if defined(CSR_DDRPHY_BASE) && defined(SDRAM_PHY_WRITE_LEVELING_CAPABLE) && defined(CSR_SDRAM_BASE)
-define_command(sdrwlon, sdrwlon, "Enable write leveling", DRAM_CMDS);
-#endif
-
-/**
- * Command "sdrwloff"
- *
- * Write leveling OFF
- *
- */
-#if defined(CSR_DDRPHY_BASE) && defined(SDRAM_PHY_WRITE_LEVELING_CAPABLE) && defined(CSR_SDRAM_BASE)
-define_command(sdrwloff, sdrwloff, "Disable write leveling", DRAM_CMDS);
-#endif
-
-/**
- * Command "sdrlevel"
- *
- * Perform read/write leveling
- *
- */
-#if defined(CSR_DDRPHY_BASE) && defined(CSR_SDRAM_BASE)
-define_command(sdrlevel, sdrlevel, "Perform read/write leveling", DRAM_CMDS);
-#endif
-
-/**
- * Command "memtest"
- *
- * Run a memory test
- *
- */
-#ifdef CSR_SDRAM_BASE
-define_command(memtest, memtest, "Run a memory test", DRAM_CMDS);
-#endif
diff --git a/litex/soc/software/bios/commands/cmd_liteeth.c b/litex/soc/software/bios/commands/cmd_liteeth.c
deleted file mode 100644 (file)
index 86e8fc8..0000000
+++ /dev/null
@@ -1,134 +0,0 @@
-// SPDX-License-Identifier: BSD-Source-Code
-
-#include <stdio.h>
-#include <stdlib.h>
-
-#include <generated/csr.h>
-
-#include "mdio.h"
-
-#include "../command.h"
-#include "../helpers.h"
-
-/**
- * Command "mdiow"
- *
- * Write MDIO register
- *
- */
-#ifdef CSR_ETHPHY_MDIO_W_ADDR
-static void mdiow(int nb_params, char **params)
-{
-       char *c;
-       unsigned int phyadr2;
-       unsigned int reg2;
-       unsigned int val2;
-
-       if (nb_params < 3) {
-               printf("mdiow <phyadr> <reg> <value>");
-               return;
-       }
-
-       phyadr2 = strtoul(params[0], &c, 0);
-       if (*c != 0) {
-               printf("Incorrect phyadr");
-               return;
-       }
-
-       reg2 = strtoul(params[1], &c, 0);
-       if (*c != 0) {
-               printf("Incorrect reg");
-               return;
-       }
-
-       val2 = strtoul(params[2], &c, 0);
-       if (*c != 0) {
-               printf("Incorrect val");
-               return;
-       }
-
-       mdio_write(phyadr2, reg2, val2);
-}
-
-define_command(mdiow, mdiow, "Write MDIO register", MDIO_CMDS);
-#endif
-
-/**
- * Command "mdior"
- *
- * Read MDIO register
- *
- */
-#ifdef CSR_ETHPHY_MDIO_W_ADDR
-static void mdior(int nb_params, char **params)
-{
-       char *c;
-       unsigned int phyadr2;
-       unsigned int reg2;
-       unsigned int val;
-
-       if (nb_params < 2) {
-               printf("mdior <phyadr> <reg>");
-               return;
-       }
-
-       phyadr2 = strtoul(params[0], &c, 0);
-       if (*c != 0) {
-               printf("Incorrect phyadr");
-               return;
-       }
-
-       reg2 = strtoul(params[1], &c, 0);
-       if (*c != 0) {
-               printf("Incorrect reg");
-               return;
-       }
-
-       val = mdio_read(phyadr2, reg2);
-       printf("Reg %d: 0x%04x", reg2, val);
-}
-
-define_command(mdior, mdior, "Read MDIO register", MDIO_CMDS);
-#endif
-
-/**
- * Command "mdiod"
- *
- * Dump MDIO registers
- *
- */
-#ifdef CSR_ETHPHY_MDIO_W_ADDR
-static void mdiod(int nb_params, char **params)
-{
-       char *c;
-       unsigned int phyadr;
-       unsigned int count;
-       unsigned int val;
-       int i;
-
-       if (nb_params < 2) {
-               printf("mdiod <phyadr> <count>");
-               return;
-       }
-
-       phyadr = strtoul(params[0], &c, 0);
-       if (*c != 0) {
-               printf("Incorrect phyadr");
-               return;
-       }
-
-       count = strtoul(params[1], &c, 0);
-       if (*c != 0) {
-               printf("Incorrect count");
-               return;
-       }
-
-       printf("MDIO dump @0x%x:\n", phyadr);
-       for (i = 0; i < count; i++) {
-               val = mdio_read(phyadr, i);
-               printf("reg %d: 0x%04x", i, val);
-       }
-}
-
-define_command(mdiod, mdiod, "Dump MDIO registers", MDIO_CMDS);
-#endif
diff --git a/litex/soc/software/bios/commands/cmd_litesdcard.c b/litex/soc/software/bios/commands/cmd_litesdcard.c
deleted file mode 100644 (file)
index 6334766..0000000
+++ /dev/null
@@ -1,144 +0,0 @@
-// SPDX-License-Identifier: BSD-Source-Code
-
-#include <stdio.h>
-#include <stdlib.h>
-
-#include <generated/csr.h>
-
-#include "sdcard.h"
-
-#include "../command.h"
-#include "../helpers.h"
-
-/**
- * Command "sdclk"
- *
- * Configure SDcard clock frequency
- *
- */
-#ifdef CSR_SDCORE_BASE
-static void sdclk(int nb_params, char **params)
-{
-       unsigned int frequ;
-       char *c;
-
-       if (nb_params < 1) {
-               printf("sdclk <frequ>");
-               return;
-       }
-
-       frequ = strtoul(params[0], &c, 0);
-       if (*c != 0) {
-               printf("Incorrect frequency");
-               return;
-       }
-
-       sdclk_set_clk(frequ);
-}
-
-struct command_struct cmd_sdclk =
-{
-       .func = sdclk,
-       .name = "sdclk",
-       .help = "SDCard set clk frequency (Mhz)",
-};
-
-define_command(sdclk, sdclk, "SDCard set clk frequency (Mhz)", SD_CMDS);
-#endif
-
-/**
- * Command "sdinit"
- *
- * Initialize SDcard
- *
- */
-#ifdef CSR_SDCORE_BASE
-define_command(sdinit, sdcard_init, "SDCard initialization", SD_CMDS);
-#endif
-
-/**
- * Command "sdtest"
- *
- * Perform SDcard read/write tests
- *
- */
-#ifdef CSR_SDCORE_BASE
-static void sdtest(int nb_params, char **params)
-{
-       unsigned int blocks;
-       char *c;
-
-       if (nb_params < 1) {
-               printf("sdtest <number of blocks>");
-               return;
-       }
-
-       blocks = strtoul(params[0], &c, 0);
-       if (*c != 0) {
-               printf("Incorrect number of blocks to write");
-               return;
-       }
-
-       sdcard_test(blocks);
-}
-
-define_command(sdtest, sdtest, "SDCard test", SD_CMDS);
-#endif
-
-/**
- * Command "sdtestread"
- *
- * Perform SDcard read test
- *
- */
-#ifdef CSR_SDCORE_BASE
-static void sdtestread(int nb_params, char **params)
-{
-       unsigned int block;
-       char *c;
-
-       if (nb_params < 1) {
-               printf("sdtestread <block number>");
-               return;
-       }
-
-       block = strtoul(params[0], &c, 0);
-       if (*c != 0) {
-               printf("Incorrect number of block to read");
-               return;
-       }
-
-       sdcard_test_read(block);
-}
-
-define_command(sdtestread, sdtestread, "SDCard test read", SD_CMDS);
-#endif
-
-/**
- * Command "sdtestwrite"
- *
- * Perform SDcard write test
- *
- */
-#ifdef CSR_SDCORE_BASE
-static void sdtestwrite(int nb_params, char **params)
-{
-       unsigned int block;
-       char *c;
-
-       if (nb_params < 2) {
-               printf("sdtestread <block number> <str to write>");
-               return;
-       }
-
-       block = strtoul(params[0], &c, 0);
-       if (*c != 0) {
-               printf("Incorrect number of block to write");
-               return;
-       }
-
-       sdcard_test_write(block, params[1]);
-}
-
-define_command(sdtestwrite, sdtestwrite, "SDCard test write", SD_CMDS);
-#endif
diff --git a/litex/soc/software/bios/commands/cmd_mem.c b/litex/soc/software/bios/commands/cmd_mem.c
deleted file mode 100644 (file)
index 8c63d4c..0000000
+++ /dev/null
@@ -1,137 +0,0 @@
-// SPDX-License-Identifier: BSD-Source-Code
-
-#include <stdio.h>
-#include <stdlib.h>
-
-#include "../command.h"
-#include "../helpers.h"
-
-/**
- * Command "mr"
- *
- * Memory read
- *
- */
-static void mr(int nb_params, char **params)
-{
-       char *c;
-       unsigned int *addr;
-       unsigned int length;
-
-       if (nb_params < 1) {
-               printf("mr <address> [length]");
-               return;
-       }
-       addr = (unsigned int *)strtoul(params[0], &c, 0);
-       if (*c != 0) {
-               printf("Incorrect address");
-               return;
-       }
-       if (nb_params == 1) {
-               length = 4;
-       } else {
-               length = strtoul(params[1], &c, 0);
-               if(*c != 0) {
-                       printf("\nIncorrect length");
-                       return;
-               }
-       }
-
-       dump_bytes(addr, length, (unsigned long)addr);
-}
-
-define_command(mr, mr, "Read address space", MEM_CMDS);
-
-/**
- * Command "mw"
- *
- * Memory write
- *
- */
-static void mw(int nb_params, char **params)
-{
-       char *c;
-       unsigned int *addr;
-       unsigned int value;
-       unsigned int count;
-       unsigned int i;
-
-       if (nb_params < 2) {
-               printf("mw <address> <value> [count]");
-               return;
-       }
-
-       addr = (unsigned int *)strtoul(params[0], &c, 0);
-       if (*c != 0) {
-               printf("Incorrect address");
-               return;
-       }
-
-       value = strtoul(params[1], &c, 0);
-       if(*c != 0) {
-               printf("Incorrect value");
-               return;
-       }
-
-       if (nb_params == 2) {
-               count = 1;
-       } else {
-               count = strtoul(params[2], &c, 0);
-               if(*c != 0) {
-                       printf("Incorrect count");
-                       return;
-               }
-       }
-
-       for (i = 0; i < count; i++)
-               *addr++ = value;
-}
-
-define_command(mw, mw, "Write address space", MEM_CMDS);
-
-/**
- * Command "mc"
- *
- * Memory copy
- *
- */
-static void mc(int nb_params, char **params)
-{
-       char *c;
-       unsigned int *dstaddr;
-       unsigned int *srcaddr;
-       unsigned int count;
-       unsigned int i;
-
-       if (nb_params < 2) {
-               printf("mc <dst> <src> [count]");
-               return;
-       }
-
-       dstaddr = (unsigned int *)strtoul(params[0], &c, 0);
-       if (*c != 0) {
-               printf("Incorrect destination address");
-               return;
-       }
-
-       srcaddr = (unsigned int *)strtoul(params[1], &c, 0);
-       if (*c != 0) {
-               printf("Incorrect source address");
-               return;
-       }
-
-       if (nb_params == 2) {
-               count = 1;
-       } else {
-               count = strtoul(params[2], &c, 0);
-               if (*c != 0) {
-                       printf("Incorrect count");
-                       return;
-               }
-       }
-
-       for (i = 0; i < count; i++)
-               *dstaddr++ = *srcaddr++;
-}
-
-define_command(mc, mc, "Copy address space", MEM_CMDS);
diff --git a/litex/soc/software/bios/commands/cmd_spiflash.c b/litex/soc/software/bios/commands/cmd_spiflash.c
deleted file mode 100644 (file)
index 8ca18c8..0000000
+++ /dev/null
@@ -1,75 +0,0 @@
-// SPDX-License-Identifier: BSD-Source-Code
-
-#include <stdio.h>
-#include <stdlib.h>
-
-#include <generated/csr.h>
-
-#include "../command.h"
-#include "../helpers.h"
-
-/**
- * Command "fw"
- *
- * Write data from a memory buffer to SPI flash
- *
- */
-#if (defined CSR_SPIFLASH_BASE && defined SPIFLASH_PAGE_SIZE)
-static void fw(int nb_params, char **params)
-{
-       char *c;
-       unsigned int addr;
-       unsigned int value;
-       unsigned int count;
-       unsigned int i;
-
-       if (nb_params < 2) {
-               printf("fw <offset> <value> [count]");
-               return;
-       }
-
-       addr = strtoul(params[0], &c, 0);
-       if (*c != 0) {
-               printf("Incorrect offset");
-               return;
-       }
-
-       value = strtoul(params[1], &c, 0);
-       if (*c != 0) {
-               printf("Incorrect value");
-               return;
-       }
-
-       if (nb_params == 2) {
-               count = 1;
-       } else {
-               count = strtoul(params[2], &c, 0);
-               if (*c != 0) {
-                       printf("Incorrect count");
-                       return;
-               }
-       }
-
-       for (i = 0; i < count; i++)
-               write_to_flash(addr + i * 4, (unsigned char *)&value, 4);
-}
-
-define_command(fw, fw, "Write to flash", SPIFLASH_CMDS);
-#endif
-
-/**
- * Command "fe"
- *
- * Flash erase
- *
- */
-#if (defined CSR_SPIFLASH_BASE && defined SPIFLASH_PAGE_SIZE)
-static void fe(int nb_params, char **params)
-{
-       erase_flash();
-       printf("Flash erased\n");
-}
-
-define_command(fe, fe, "Erase whole flash", SPIFLASH_CMDS);
-#endif
-