Skip to content

Add BLE in Obelix.#6

Closed
gangheivt wants to merge 0 commit intocoredevices:mainfrom
gangheivt:main
Closed

Add BLE in Obelix.#6
gangheivt wants to merge 0 commit intocoredevices:mainfrom
gangheivt:main

Conversation

@gangheivt
Copy link

No description provided.

Comment on lines 1 to 46
/**
******************************************************************************
* @file ipc_os_port.h
* @author Sifli software development team
* @brief Sifli ipc hw interface
* @{
******************************************************************************
*/
/*
* @attention
* Copyright (c) 2019 - 2022, Sifli Technology
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form, except as embedded into a Sifli integrated circuit
* in a product or a software update for such product, must reproduce the above
* copyright notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* 3. Neither the name of Sifli nor the names of its contributors may be used to endorse
* or promote products derived from this software without specific prior written permission.
*
* 4. This software, with or without modification, must only be used with a
* Sifli integrated circuit.
*
* 5. Any software provided in binary form under this license must not be reverse
* engineered, decompiled, modified and/or disassembled.
*
* THIS SOFTWARE IS PROVIDED BY SIFLI TECHNOLOGY "AS IS" AND ANY EXPRESS
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL SIFLI TECHNOLOGY OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
Copy link
Member

Choose a reason for hiding this comment

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

needs apache-2.0 header


__STATIC_FORCEINLINE int os_interrupt_disable(void)
{
__disable_irq();
Copy link
Member

Choose a reason for hiding this comment

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

you likely want vPortEnterCritical ?

return 0;
}

#define os_interrupt_enable(mask) __enable_irq()
Copy link
Member

Choose a reason for hiding this comment

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

vPortExitCritical ?

Comment on lines 18 to 27
micro_sources += bld.path.ant_glob('SiFli-SDK/drivers/cmsis/sf32lb52x/bf0_pin_const.c')
micro_sources += bld.path.ant_glob('SiFli-SDK/drivers/cmsis/sf32lb52x/bf0_lcpu_init.c')
micro_sources += bld.path.ant_glob('SiFli-SDK/drivers/cmsis/sf32lb52x/lcpu_patch.c')
micro_sources += bld.path.ant_glob('SiFli-SDK/drivers/cmsis/sf32lb52x/lcpu_patch_rev_b.c')
micro_sources += bld.path.ant_glob('SiFli-SDK/drivers/cmsis/sf32lb52x/bt_rf_fulcal.c')
micro_sources += bld.path.ant_glob('SiFli-SDK/drivers/cmsis/sf32lb52x/bt_rf_cw_config.c')
micro_sources += bld.path.ant_glob('SiFli-SDK/drivers/cmsis/sf32lb52x/bt_power_config.c')
micro_sources += bld.path.ant_glob('SiFli-SDK/customer/boards/eh-lb52xu/*.c')
micro_includes = [
Copy link
Member

Choose a reason for hiding this comment

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

add sources to the list above, so diff is readable, it has all been shuffled now.

Comment on lines 115 to 118
portDISABLE_INTERRUPTS();
HAL_DBG_printf("%s, %s %d\n", hci_type_str(type), host2ctrl?"TX":"RX", len);
HAL_DBG_print_data((char*)data,0,len);
portENABLE_INTERRUPTS();
Copy link
Member

Choose a reason for hiding this comment

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

doesn't seem safe, as console is owned by the OS.

Comment on lines 1 to 5
#include <stdint.h>
#include <string.h>
#include "mem_map.h"
#include "rtconfig.h"
#include "register.h"
Copy link
Member

@gmarull gmarull Jun 9, 2025

Choose a reason for hiding this comment

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

not all are needed

Copy link
Author

Choose a reason for hiding this comment

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

This is generated one, not just for this project.

Copy link
Member

Choose a reason for hiding this comment

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

how is this generated? is this publicly available to add some references?

Comment on lines 77 to 79
nimble_includes = [
'port/include/cc2564x',
] + nimble_includes
Copy link
Member

Choose a reason for hiding this comment

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

a new port config has to be created, replicate cc2564x setup with sf32lb52

ctx.recurse('nimble')
ctx.recurse('ti_bt_sp')
elif ctx.env.bt_controller == 'nrf52':
elif ctx.env.bt_controller == 'nrf52' or ctx.env.bt_controller == 'sf32lb52':
Copy link
Member

Choose a reason for hiding this comment

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

in ('nrf52', 'sf32lb52')

Comment on lines 413 to 421
int r=bt_mac_addr_generate_via_uid_v2(&(g_ble_slp_default_rc10k[2]));
uint8_t *nvds_addr = (uint8_t *)NVDS_BUFF_START;//0x204FFD00;

*(uint32_t *)nvds_addr = 0x4E564453;
*(uint16_t *)(nvds_addr+4) = sizeof(g_ble_slp_default_rc10k);
*(uint16_t *)(nvds_addr+6) = 0;
memcpy((void*)(nvds_addr+8), g_ble_slp_default_rc10k, sizeof(g_ble_slp_default_rc10k));
HAL_DBG_printf("add: %d\r", r);
HAL_DBG_print_data((char *)nvds_addr, 0, 8+sizeof(g_ble_slp_default_rc10k));
Copy link
Member

Choose a reason for hiding this comment

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

magic number/offsets, they need to be defined. code needs to be generic so we can operate on LXT32 or RC10K.

Comment on lines 378 to 384
memcpy((void *)addr, (void *)&uid[0], 6);
if (use_v2)
{
result = 0;
}
else
result = -5;
Copy link
Member

Choose a reason for hiding this comment

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

in general: run clang-format on these files.

@gmarull
Copy link
Member

gmarull commented Jun 9, 2025

also: make sure to add changes in smaller chunks (see obelix PR as an example).

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.

2 participants