Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 16 additions & 3 deletions ref_app/src/math/functions/math_functions_bessel.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////////
// Copyright Christopher Kormanyos 2014 - 2025.
// Copyright Christopher Kormanyos 2014 - 2026.
// Distributed under the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt
// or copy at http://www.boost.org/LICENSE_1_0.txt)
Expand All @@ -22,11 +22,24 @@
// Compute the Taylor series representation of cyl_bessel_j.
// There are no checks on input range or parameter boundaries.

// The following low-precision analysis has been carried out
// for another perspective on small arguments.

// Series[BesselJ[n, x], {x, 0, 7}]
// Normal[%]
// FullSimplify[%]
// Then explicitly take the polynomial part and run it through HornerForm[...].
// The result is the following.
// (1/(3 Gamma[4 + n])) 2^(-7 - n) x^n (384 (1 + n) (2 + n) (3 + n) - x^2 (576 + n (480 + 96 n) + x^2 (36 + 12 n - x^2)))
// This should provide good precision for 32-bit float for arguments having (x/n) <= 3/10.

const T x_half = x / 2;
const T v_plus_one = v + 1;

const T hypergeometric_0f1_term =
math::functions::hypergeometric_0f1(v_plus_one, -(x_half * x_half));
const T hypergeometric_0f1_term
{
math::functions::hypergeometric_0f1(v_plus_one, -(x_half * x_half))
};

using std::pow;
using std::tgamma;
Expand Down
16 changes: 10 additions & 6 deletions ref_app/target/micros/xtensa_esp32_p4/make/xtensa_esp32_p4.ld
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ SECTIONS
*(.data*)
. = ALIGN(4);
KEEP (*(.data*))
_small_ram_begin = .;
*(.sdata)
. = ALIGN(4);
KEEP (*(.sdata))
Expand All @@ -135,18 +136,19 @@ SECTIONS
.bss : ALIGN(4)
{
_bss_begin = .;
*(.bss)
. = ALIGN(4);
KEEP (*(.bss))
*(.bss*)
. = ALIGN(4);
KEEP (*(.bss*))
*(.sbss)
. = ALIGN(4);
KEEP (*(.sbss))
*(.sbss*)
. = ALIGN(4);
KEEP (*(.sbss*))
_small_ram_end = .;
*(.bss)
. = ALIGN(4);
KEEP (*(.bss))
*(.bss*)
. = ALIGN(4);
KEEP (*(.bss*))
_bss_end = .;
} > RAM

Expand Down Expand Up @@ -174,4 +176,6 @@ SECTIONS
printf = 0x4fc00024;

_rom_data_begin = LOADADDR(.data);

_global_pointer = _small_ram_begin + (_small_ram_end - _small_ram_begin) / 2;
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ TGT_ALLFLAGS = -O2
-march=rv32imafc_zicsr_zifencei_xesppie \
-mabi=ilp32f \
-msmall-data-limit=32 \
-mrelax \
-mrelax \
-fno-common \
-falign-functions=4 \
-fomit-frame-pointer \
-DHP_CORES_SMP_MODE
Expand All @@ -40,6 +43,7 @@ TGT_AFLAGS =

TGT_LDFLAGS = -nostdlib \
-nostartfiles \
$(TGT_ALLFLAGS) \
-Wl,--no-warn-rwx-segments \
-Wl,-z,max-page-size=4096 \
-Wl,-Map,$(APP).map \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
.align 2
.globl _start
.extern main_x
.extern _global_pointer

.set mtvt, 0x307
.set msip, 0x20000000
Expand All @@ -56,6 +57,9 @@ _start:
csrs mstatus, t0
fscsr x0

/* Set/enable the global pointer for small ram */
la gp, _global_pointer

/* Read machine hart ID */
csrr a0, mhartid
bnez a0, .L_core1
Expand Down
Loading