mirror of
https://github.com/esp8266/Arduino.git
synced 2025-06-13 13:01:55 +03:00
optionally move float emulation code into iram (#8958)
* optionally move float emulation code into iram allows doing float operation in iram suitable for libraries like AccelStepper when called from ISR * proposed changes for pio from @mcspr
This commit is contained in:
@ -1682,6 +1682,17 @@ def sdk ():
|
||||
|
||||
################################################################
|
||||
|
||||
def float_in_iram ():
|
||||
return { 'iramfloat': collections.OrderedDict([
|
||||
('.menu.iramfloat.no', 'in IROM'),
|
||||
('.menu.iramfloat.no.build.iramfloat', '-DFP_IN_IROM'),
|
||||
('.menu.iramfloat.yes', 'allowed in ISR'),
|
||||
('.menu.iramfloat.yes.build.iramfloat', '-DFP_IN_IRAM'),
|
||||
])
|
||||
}
|
||||
|
||||
################################################################
|
||||
|
||||
def all_boards ():
|
||||
|
||||
if boardsgen or boardslocalgen:
|
||||
@ -1709,6 +1720,7 @@ def all_boards ():
|
||||
macros.update(led('led', led_default, range(0,led_max+1)))
|
||||
macros.update(led('led216', 2, { 16 }))
|
||||
macros.update(sdk())
|
||||
macros.update(float_in_iram())
|
||||
|
||||
if boardfilteropt or excludeboards:
|
||||
print('#')
|
||||
@ -1754,6 +1766,7 @@ def all_boards ():
|
||||
print('menu.stacksmash=Stack Protection')
|
||||
print('menu.wipe=Erase Flash')
|
||||
print('menu.sdk=NONOS SDK Version')
|
||||
print('menu.iramfloat=Floating Point operations')
|
||||
print('menu.ssl=SSL Support')
|
||||
print('menu.mmu=MMU')
|
||||
print('menu.non32xfer=Non-32-Bit Access')
|
||||
@ -1791,6 +1804,7 @@ def all_boards ():
|
||||
macrolist += speeds[default_speed]
|
||||
|
||||
macrolist += [ 'autoflash' ]
|
||||
macrolist += [ 'iramfloat' ]
|
||||
|
||||
for block in macrolist:
|
||||
for optname in macros[block]:
|
||||
|
@ -275,17 +275,23 @@ else:
|
||||
#
|
||||
|
||||
current_vtables = None
|
||||
fp_in_irom = ""
|
||||
current_fp = None
|
||||
for d in flatten_cppdefines:
|
||||
if str(d).startswith("VTABLES_IN_"):
|
||||
current_vtables = d
|
||||
if str(d) == "FP_IN_IROM":
|
||||
fp_in_irom = "-DFP_IN_IROM"
|
||||
if str(d).startswith("FP_IN_"):
|
||||
current_fp = d
|
||||
|
||||
if not current_vtables:
|
||||
current_vtables = "VTABLES_IN_FLASH"
|
||||
env.Append(CPPDEFINES=[current_vtables])
|
||||
assert current_vtables
|
||||
|
||||
if not current_fp:
|
||||
current_fp = "FP_IN_IROM"
|
||||
env.Append(CPPDEFINES=[current_fp])
|
||||
assert current_fp
|
||||
|
||||
#
|
||||
# MMU
|
||||
#
|
||||
@ -363,9 +369,10 @@ app_ld = env.Command(
|
||||
join("$BUILD_DIR", "ld", "local.eagle.app.v6.common.ld"),
|
||||
join(FRAMEWORK_DIR, "tools", "sdk", "ld", "eagle.app.v6.common.ld.h"),
|
||||
env.VerboseAction(
|
||||
"$CC -CC -E -P -D%s %s %s $SOURCE -o $TARGET"
|
||||
"$CC -CC -E -P -D%s -D%s %s $SOURCE -o $TARGET"
|
||||
% (
|
||||
current_vtables,
|
||||
current_fp,
|
||||
# String representation of MMU flags
|
||||
" ".join(
|
||||
[
|
||||
@ -373,7 +380,6 @@ app_ld = env.Command(
|
||||
for f in mmu_flags
|
||||
]
|
||||
),
|
||||
fp_in_irom,
|
||||
),
|
||||
"Generating LD script $TARGET",
|
||||
),
|
||||
|
@ -142,6 +142,16 @@ SECTIONS
|
||||
|
||||
/* all functional callers are placed in IRAM (including SPI/IRQ callbacks/etc) here */
|
||||
*(.text._ZNKSt8functionIF*EE*) /* std::function<any(...)>::operator()() const */
|
||||
|
||||
#ifdef FP_IN_IRAM
|
||||
*libgcc.a:*f2.o(.literal .text)
|
||||
*libgcc.a:*f3.o(.literal .text)
|
||||
*libgcc.a:*fsi.o(.literal .text)
|
||||
*libgcc.a:*fdi.o(.literal .text)
|
||||
*libgcc.a:*ifs.o(.literal .text)
|
||||
*libgcc.a:*idf.o(.literal .text)
|
||||
#endif
|
||||
|
||||
} >iram1_0_seg :iram1_0_phdr
|
||||
|
||||
.irom0.text : ALIGN(4)
|
||||
|
Reference in New Issue
Block a user