Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

arm/tlsr82: ble performance optimize and problems solve. #6334

Merged
merged 1 commit into from
May 30, 2022

Conversation

CV-Bowen
Copy link
Contributor

@CV-Bowen CV-Bowen commented May 27, 2022

Summary

RF and system timer interrupt are used for ble.

tlsr82_flash.c:

  1. BLE will loss packets during flash operation beacause the interrupt
    is disabled and the operation take too long (especially erasing,
    about 100ms), so allow RF and system timer interrupt during flash
    operation;
  2. Add sched_lock()/sched_unlock() to avoid the task switch in ble and
    system timer interrupt;

flash_boot_ble.ld:
3. Because of 1, the code executes in RF and system timer interrupt
must be in ram to avoid bus error. The sem_post() will be called and
const variable g_tasklisttable will be accessed in RF and system
timer interrupt handler;
4. To improve the performance, copy some frequently called function to
ram as well, such as: sem_take(), sched_lock(), sched_unlock(),
some lib functions, some zephyr ble functions and some tinycrypt
functions;
5. The RF and system timer interrupt handler will call some libgcc
functions, so copy all the libgcc functions to ram exclude _divdi3.o,
_udivdi3.o and _umoddi3.o;

tlsr82_serial.c
6. Make up_putc() be thread safe;

tc32_doirq.c
7. Increase the RF and system timer interrupt response priority;

Impact

tlsr82 ble

Testing

local test

arch/arm/src/tlsr82/tlsr82_serial.c Outdated Show resolved Hide resolved
arch/arm/src/tlsr82/tlsr82_serial.c Outdated Show resolved Hide resolved
RF and system timer interrupt are used for ble.

tlsr82_flash.c:
1. BLE will loss packets during flash operation beacause the interrupt
   is disabled and the operation take too long (especially erasing,
   about 100ms), so allow RF and system timer interrupt during flash
   operation;
2. Add sched_lock()/sched_unlock() to avoid the task switch in ble and
   system timer interrupt;

flash_boot_ble.ld:
3. Because of 1, the code executes in RF and system timer interrupt
   must be in ram to avoid bus error. The sem_post() will be called and
   const variable g_tasklisttable will be accessed in RF and system
   timer interrupt handler;
4. To improve the performance, copy some frequently called function to
   ram as well, such as: sem_take(), sched_lock(), sched_unlock(),
   some lib functions, some zephyr ble functions and some tinycrypt
   functions;
5. The RF and system timer interrupt handler will call some libgcc
   functions, so copy all the libgcc functions to ram exclude _divdi3.o,
   _udivdi3.o and _umoddi3.o;

tlsr82_serial.c
6. Make up_putc() be thread safe, add enter/leave_critical_section() in
   function uart_send_byte();

tc32_doirq.c
7. Increase the RF and system timer interrupt response priority;

Signed-off-by: wangbowen6 <wangbowen6@xiaomi.com>
Copy link
Contributor

@pkarashchenko pkarashchenko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@xiaoxiang781216 xiaoxiang781216 merged commit 360e319 into apache:master May 30, 2022
@CV-Bowen CV-Bowen deleted the tlsr82_ble_pr branch June 14, 2022 02:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants