+ фикс кривых проверок на наличие uint8_t
+ фикс перевод float в iq + фикс поиска вручнуб добавленных переменных в debug_vars.c
This commit is contained in:
parent
c55f38ef1c
commit
043359fe66
BIN
DebugVarEdit.exe
BIN
DebugVarEdit.exe
Binary file not shown.
@ -285,15 +285,20 @@ def add_new_vars_to_xml(proj_path, xml_rel_path, output_path):
|
||||
Возвращает True если что-то добавлено и XML перезаписан, иначе False.
|
||||
"""
|
||||
|
||||
pattern = re.compile(
|
||||
r'{\s*\(uint8_t\s*\*\)\s*&([a-zA-Z_][a-zA-Z0-9_]*(?:\[.*?\])?(?:(?:\.|->)[a-zA-Z_][a-zA-Z0-9_]*(?:\[.*?\])?)*)\s*,\s*'
|
||||
r'(pt_\w+)\s*,\s*'
|
||||
r'(t?_?iq\w+)\s*,\s*'
|
||||
r'(t?_?iq\w+)\s*,\s*'
|
||||
r'"([^"]+)"'
|
||||
)
|
||||
# Считываем существующие переменные
|
||||
parsed_vars = {}
|
||||
if os.path.isfile(output_path):
|
||||
with open(output_path, 'r', encoding='utf-8', errors='ignore') as f:
|
||||
for line in f:
|
||||
# {(uint8_t *)&some.deep.var.name , pt_uint16 , t_iq15 , "ShortName"},
|
||||
m = re.match(
|
||||
r'{\s*\(uint8_t\s*\*\)\s*&([a-zA-Z_][a-zA-Z0-9_]*(?:\.[a-zA-Z_][a-zA-Z0-9_]*)*)\s*,\s*(pt_\w+)\s*,\s*(t?iq_\w+)\s*,\s*"([^"]+)"',
|
||||
line)
|
||||
# {(uint8_t *)&some.deep.var.name , pt_uint16 , t_iq15 , t_iq10, "ShortName"},
|
||||
m = pattern.search(line)
|
||||
if m:
|
||||
full_varname = m.group(1) # e.g., some.deep.var.name
|
||||
pt_type = m.group(2)
|
||||
@ -556,7 +561,7 @@ def generate_vars_file(proj_path, xml_path, output_dir):
|
||||
out_lines.append(f'int DebugVar_Qnt = {len(all_debug_lines)};')
|
||||
if stm_flag_global == 0:
|
||||
out_lines.append('#pragma DATA_SECTION(dbg_vars,".dbgvar_info")')
|
||||
out_lines.append('// pointer_type iq_type return_iq_type short_name')
|
||||
out_lines.append('// pointer_type iq_type return_iq_type short_name')
|
||||
out_lines.append('DebugVar_t dbg_vars[] = {\\')
|
||||
out_lines.extend(all_debug_lines)
|
||||
out_lines.append('};')
|
||||
|
@ -197,9 +197,9 @@ static int convertDebugVarToIQx(DebugVar_t *var, int32_t *ret_var)
|
||||
// Êîíâåðòàöèÿ ê GLOBAL_Q (64-áèò)
|
||||
if (var->iq_type == t_iq_none) {
|
||||
if (var->ptr_type == pt_float) {
|
||||
// float_numb óìíîæàåì íà 2^GLOBAL_Q (2^24=16777216)
|
||||
// float_numb óìíîæàåì íà 2^GLOBAL_Q
|
||||
// Ðåçóëüòàò ïðèâîäèì ê 64 áèòà
|
||||
iq_united64 = (int64_t)(float_numb * 16777216.0f);
|
||||
iq_united64 = (int64_t)(float_numb * (1 << GLOBAL_Q));
|
||||
} else {
|
||||
iq_united64 = ((int64_t)iq_numb) << GLOBAL_Q;
|
||||
}
|
||||
|
@ -4,14 +4,8 @@
|
||||
#include <limits.h>
|
||||
|
||||
|
||||
//#if (LONG_MAX != 2147483647L)
|
||||
//# error "debug_tools: this code assumes 32-bit long. Please update DebugValue_t typedef."
|
||||
//#endif
|
||||
|
||||
|
||||
|
||||
|
||||
#if defined(uint8_t) && defined(int8_t) // Åñëè åñòü òèï 8 áèò - çí÷à÷èò àäðåñàöèÿ ïî 8 áèò
|
||||
#if UINT8_MAX // Ĺńëč ĺńňü ňčď 8 áčň - çí÷ŕ÷čň ŕäđĺńŕöč˙ ďî 8 áčň
|
||||
|
||||
#define ALIGN_8BIT 0x0 ///< Âûðàâíèâàíèå áåç îãðàíè÷åíèé (ëþáîé àäðåñ)
|
||||
#define ALIGN_16BIT 0x1 ///< Âûðàâíèâàíèå: àäðåñ äîëæåí áûòü êðàòåí 2 (addr & 0x1 == 0)
|
||||
@ -29,19 +23,13 @@
|
||||
|
||||
#endif //STM32/TMS32
|
||||
|
||||
|
||||
#if !defined(uint8_t)
|
||||
#if !UINT8_MAX
|
||||
typedef unsigned char uint8_t;
|
||||
#endif
|
||||
#if !defined(int8_t)
|
||||
typedef signed char int8_t;
|
||||
#endif
|
||||
#if !defined(NULL)
|
||||
#define NULL 0
|
||||
#endif
|
||||
#if !defined(NULL)
|
||||
#define NULL 0
|
||||
#endif
|
||||
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user