Skip to content

Commit 1543dcc

Browse files
committed
Now ESTALLOC is the standard allocator
1 parent 9c8d6e6 commit 1543dcc

File tree

3 files changed

+16
-8
lines changed

3 files changed

+16
-8
lines changed

build_config/r2p2_w-microruby-cortex-m33.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@
1010
conf.cc.defines << "MRB_TICK_UNIT=1"
1111
conf.cc.defines << "MRB_TIMESLICE_TICK_COUNT=10"
1212

13-
conf.cc.defines << "PICORB_ALLOC_DEFAULT"
14-
# conf.cc.defines << "PICORB_ALLOC_ESTALLOC"
15-
# conf.cc.defines << "ESTALLOC_DEBUG"
13+
conf.cc.defines << "PICORB_ALLOC_ESTALLOC"
14+
conf.cc.defines << "ESTALLOC_DEBUG"
1615
conf.cc.defines << "MRB_32BIT"
16+
conf.cc.defines << "MRB_INT64"
1717
conf.cc.defines << "USE_FAT_FLASH_DISK=1"
1818
conf.cc.defines << "USE_WIFI"
1919

Submodule estalloc updated 1 file

mrbgems/picoruby-mruby/mrbgem.rake

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,19 +19,27 @@ MRuby::Gem::Specification.new('picoruby-mruby') do |spec|
1919
spec.cc.include_paths << "#{build.gems['mruby-compiler2'].dir}/include"
2020
spec.cc.include_paths << "#{build.gems['mruby-compiler2'].dir}/lib/prism/include"
2121

22-
align = 4
22+
ALIGN = 4 # or 8
23+
24+
build.cc.defines << "MRB_INT64"
25+
26+
if spec.cc.defines.include?("PICORB_ALLOC_O1HEAP")
27+
heap_page_size = o1heap_page_size(13)
28+
else
29+
heap_page_size = 256
30+
end
31+
spec.cc.defines << "MRB_HEAP_PAGE_SIZE=#{heap_page_size}"
2332

2433
if spec.cc.defines.include?("PICORB_ALLOC_TINYALLOC")
2534
alloc_dir = "#{dir}/lib/tinyalloc"
26-
spec.cc.defines << "TA_ALIGNMENT=#{align}"
35+
spec.cc.defines << "TA_ALIGNMENT=#{ALIGN}"
2736
elsif spec.cc.defines.include?("PICORB_ALLOC_O1HEAP")
2837
alloc_dir = "#{dir}/lib/o1heap/o1heap"
2938
unless File.directory?(alloc_dir)
3039
FileUtils.cd "#{dir}/lib" do
3140
sh "git clone https://github.com/pavel-kirienko/o1heap"
3241
end
3342
end
34-
spec.cc.defines << "MRB_HEAP_PAGE_SIZE=#{o1heap_page_size(13)}"
3543
elsif spec.cc.defines.include?("PICORB_ALLOC_TLSF")
3644
alloc_dir = "#{dir}/lib/tlsf"
3745
unless File.directory?(alloc_dir)
@@ -43,7 +51,7 @@ MRuby::Gem::Specification.new('picoruby-mruby') do |spec|
4351
spec.cc.defines << "_DEBUG"
4452
end
4553
elsif spec.cc.defines.include?("PICORB_ALLOC_ESTALLOC")
46-
spec.cc.defines << "ESTALLOC_ALIGNMENT=#{align}"
54+
spec.cc.defines << "ESTALLOC_ALIGNMENT=#{ALIGN}"
4755
if spec.cc.defines.any?{ _1.start_with?("PICORUBY_DEBUG") }
4856
spec.cc.defines << "ESTALLOC_DEBUG=1"
4957
end

0 commit comments

Comments
 (0)