I downloaded bitstream from link shrike/examples/led_blink/bitstream at main · vicharak-in/shrike · GitHub and sued below code.
ESP 32 S3 is booting and working , but led of fpga not blinking.
#include <Arduino.h>
#include <FS.h>
#include <LittleFS.h>
#include <ESP32Time.h>
#include <time.h>
#include “Shrike.h”
#define LOG_FILE_PATH “/log.txt”
#define OLD_FILE_PATH “/log.old”
#define LOG_FILE_SIZE 0x200000
#define DEBUG 1
ESP32Time rtc(0);
File logFile;
SemaphoreHandle_t logMutex;
ShrikeFlash fpga;
void rotateLogFile() {
if (logFile) logFile.close();
if (LittleFS.exists(OLD_FILE_PATH)) LittleFS.remove(OLD_FILE_PATH);
if (LittleFS.exists(LOG_FILE_PATH)) LittleFS.rename(LOG_FILE_PATH, OLD_FILE_PATH);
logFile = LittleFS.open(LOG_FILE_PATH, “a”);
}
int log_vprintf(const char *fmt, va_list args) {
char log_buffer[256];
int len = vsnprintf(log_buffer, sizeof(log_buffer), fmt, args);
if (len > 0) {
if (logMutex != NULL && xSemaphoreTake(logMutex, pdMS_TO_TICKS(50)) == pdTRUE) {
if (logFile) {
if (logFile.size() + len > LOG_FILE_SIZE) rotateLogFile();
if (logFile) {
logFile.print(log_buffer);
logFile.flush();
}
}
xSemaphoreGive(logMutex);
}
}
return len;
}
void listAllFiles(fs::FS &fs, const char *dirname) {
#ifdef DEBUG
Serial.println(“This is LittleFS”);
Serial.printf(“Total space: %u MB\n”, LittleFS.totalBytes() / (1024 * 1024));
Serial.printf(“Used space: %u MB\n”, LittleFS.usedBytes() / (1024 * 1024));
Serial.printf(“Free space: %u MB\n”, (LittleFS.totalBytes() - LittleFS.usedBytes()) / (1024 * 1024));
Serial.printf(“Listing directory: %s\n”, dirname);
#endif
File root = fs.open(dirname);
if (!root) {
esp_log_write(ESP_LOG_ERROR, “ECSYS”, “%lu Failed to open directory\n”, rtc.getLocalEpoch());
return;
}
if (!root.isDirectory()) {
esp_log_write(ESP_LOG_ERROR, “ECSYS”, “%lu Not a directory\n”, rtc.getLocalEpoch());
return;
}
File file = root.openNextFile();
while (file) {
#ifdef DEBUG
Serial.printf(“%s %d Bytes\n”, file.name(), file.size());
#endif
String fn(file.name());
//if (fn.endsWith(“.avi”) && !file.size()) fs.remove((String(“/”) + String(file.name())).c_str());
file = root.openNextFile();
}
}
void setup() {
Serial.begin(115200);
if (LittleFS.begin()) {
Serial.println(“File system mounted”);
} else {
Serial.println(“File system NOT mounted. System halted”);
while (1) delay(100);
}
esp_log_level_set(“*”, ESP_LOG_VERBOSE);
esp_log_set_vprintf(&log_vprintf);
esp_log_write(ESP_LOG_INFO, “ECSYS”, “%lu Booting and last reset reason %d\n”, rtc.getLocalEpoch(), esp_reset_reason());
listAllFiles(LittleFS,“/”);
if (!fpga.begin())Serial.println(“Failed to initialize ShrikeFlash!”);
fpga.printFSInfo();
fpga.listFiles();
if (fpga.fileExists(“/led_blink.bin”)) {
fpga.flash(“/led_blink.bin”);
}
fpga.flash(“/led_blink.bin”);
Serial.println(“Starting…”);
}
void loop() {
// put your main code here, to run repeatedly:
}