Skip to content

Commit

Permalink
Add FAT FileSystem on ESP32
Browse files Browse the repository at this point in the history
  • Loading branch information
yuuu committed Feb 2, 2025
1 parent 1098cec commit c3b716d
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 3 deletions.
3 changes: 2 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ idf_component_register(
${COMPONENT_DIR}/picoruby/mrbgems/picoruby-mrubyc/lib/mrubyc/src
${COMPONENT_DIR}/picoruby/mrbgems/picoruby-machine/include
${COMPONENT_DIR}/picoruby/mrbgems/picoruby-filesystem-fat/ports/esp32
REQUIRES esp_driver_uart
REQUIRES esp_driver_uart spi_flash
)

add_definitions(
Expand All @@ -19,6 +19,7 @@ add_definitions(
-DMRBC_USE_FLOAT=2
-DMRC_CUSTOM_ALLOC
-DMRBC_CONVERT_CRLF=1
-DUSE_FAT_FLASH_DISK
-DNDEBUG
)

Expand Down
21 changes: 20 additions & 1 deletion mrblib/main_task.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,31 @@
STDIN.echo = false
$shell = Shell.new(clean: true)

puts "Initializing FLASH disk as the root volume... "
$shell.setup_root_volume(:flash, label: 'storage')
$shell.setup_system_files
puts "Available"
end
rescue => e
puts "Not available"
puts "#{e.message} (#{e.class})"
end

begin
Machine.using_delay do
if File.exist?("/home/app.mrb")
puts "Loading app.mrb"
load "/home/app.mrb"
elsif File.exist?("/home/app.rb")
puts "Loading app.rb"
load "/home/app.rb"
end

puts "Starting shell...\n\n"

$shell.show_logo
$shell.start
end
rescue => e
puts "Not available"
puts "#{e.message} (#{e.class})"
end
2 changes: 1 addition & 1 deletion picoruby

0 comments on commit c3b716d

Please sign in to comment.