Skip to content

Develop/nn#13

Merged
00lllooolll00 merged 5 commits into
masterfrom
develop/nn
Mar 19, 2026
Merged

Develop/nn#13
00lllooolll00 merged 5 commits into
masterfrom
develop/nn

Conversation

@00lllooolll00

Copy link
Copy Markdown
Collaborator

No description provided.

Copilot AI review requested due to automatic review settings March 18, 2026 10:40

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR extends the core utilities/hal headers with improved C++ interoperability (via extern "C" guards), hardens several macros by adding missing parentheses, and adds a new dynamic-string API for in-place reversal.

Changes:

  • Add ek_str_reverse() API + a corresponding log-based test snippet.
  • Add extern "C" guards to multiple public headers to support inclusion from C++.
  • Parenthesize macro arguments across utils (vec/mem/log/export/etc.) and rename ek_list parameters away from C++ keywords.

Reviewed changes

Copilot reviewed 27 out of 27 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
Test/str_test.c Adds a basic reverse-string exercise in the string test.
L2_Core/utils/src/ek_str.c Adds ek_str_reverse() and refactors/moves _ek_str_ensure_cap.
L2_Core/utils/inc/ek_str.h Declares ek_str_reverse() and adds C++ linkage guards.
L2_Core/utils/inc/ek_vec.h Improves macro safety by parenthesizing vector macro operands.
L2_Core/utils/inc/ek_mem.h Parenthesizes allocator macro arguments.
L2_Core/utils/inc/ek_log.h Parenthesizes EK_LOG_FILE_TAG argument.
L2_Core/utils/inc/ek_export.h Tweaks export macros and adds C++ linkage guards for ek_export_init.
L2_Core/utils/inc/ek_def.h Adds frequency helper macros and minor macro parenthesization/formatting.
L2_Core/utils/inc/ek_assert.h Adds C++ linkage guards for ek_assert_fault.
L2_Core/utils/inc/ek_io.h Adds C++ linkage guards for ek_io_init.
L2_Core/utils/inc/ek_list.h Adjusts include indentation and renames new parameter to new_node.
L2_Core/utils/inc/ek_stack.h Parenthesizes ek_stack_destroy_safely argument.
L2_Core/utils/inc/ek_ringbuf.h Parenthesizes ek_ringbuf_destroy_safely argument and removes stray whitespace.
L2_Core/port/inc/st_hal_port.h Adds C++ linkage guards.
L2_Core/port/inc/gd_hal_port.h Adds C++ linkage guards.
L2_Core/hal/inc/ek_hal_uart.h Adds C++ linkage guards.
L2_Core/hal/inc/ek_hal_tim.h Adds C++ linkage guards.
L2_Core/hal/inc/ek_hal_tick.h Adds C++ linkage guards.
L2_Core/hal/inc/ek_hal_spi.h Adds C++ linkage guards.
L2_Core/hal/inc/ek_hal_pwm.h Adds C++ linkage guards.
L2_Core/hal/inc/ek_hal_ltdc.h Adds C++ linkage guards.
L2_Core/hal/inc/ek_hal_i2c.h Adds C++ linkage guards.
L2_Core/hal/inc/ek_hal_gpio.h Adds C++ linkage guards.
L2_Core/hal/inc/ek_hal_dma2d.h Adds C++ linkage guards.
L2_Core/hal/inc/ek_hal_dma.h Adds C++ linkage guards.
L2_Core/hal/inc/ek_hal_dac.h Adds C++ linkage guards.
L2_Core/hal/inc/ek_hal_adc.h Adds C++ linkage guards and formats the ADC enum declaration.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +61 to +64
# define EK_EXPORT_HARDWARE(fn) EK_EXPORT((fn), 0)
# define EK_EXPORT_COMPONENTS(fn) EK_EXPORT((fn), 1)
# define EK_EXPORT_APP(fn) EK_EXPORT((fn), 2)
# define EK_EXPORT_USER(fn) EK_EXPORT((fn), 3)
Comment thread Test/str_test.c
Comment on lines +56 to +59
EK_LOG_INFO("string:%s", ek_str_get_cstring(s2));
EK_LOG_INFO("reverse start");
ek_str_reverse(s2);
EK_LOG_INFO("reverse result:%s", ek_str_get_cstring(s2));
if (_temp_for_new_items_ != NULL) \
{ \
(v).cap = _temp_for_cap_ex_; \
(v).items = _temp_for_new_items_; \
ek_assert_param(s != NULL);

if (s->buf == NULL) return false;

Comment on lines +220 to +236
uint32_t new_cap = s->cap;
do
{
if (new_cap == 0) new_cap = 2;
new_cap += new_cap / 2;
} while (new_cap < len);

char *buf = NULL;

if (s->buf == NULL) buf = ek_malloc(len);
else buf = ek_realloc(s->buf, new_cap);

if (buf == NULL) return false;

s->buf = buf;
s->cap = new_cap;

@00lllooolll00 00lllooolll00 merged commit b1fa1d2 into master Mar 19, 2026
12 checks passed
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