Skip to content

Commit 0a90c91

Browse files
committed
Fixed revision identification.
1 parent 2e75ccb commit 0a90c91

12 files changed

Lines changed: 67 additions & 37 deletions

File tree

pgui/link.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -426,13 +426,13 @@ link_fetch_hwinfo(struct link_pmc *lp)
426426

427427
tok = lk_token(&sp);
428428

429-
if (strcmp(tok, "Revision") == 0) {
429+
if (strcmp(tok, "Hardware") == 0) {
430430

431-
sprintf(lp->hw.revision, "%.64s", lk_token(&sp));
431+
sprintf(lp->hw.hardware, "%.64s", lk_token(&sp));
432432
}
433-
else if (strcmp(tok, "Identify") == 0) {
433+
else if (strcmp(tok, "Revision") == 0) {
434434

435-
sprintf(lp->hw.identify, "%.64s", lk_token(&sp));
435+
sprintf(lp->hw.revision, "%.64s", lk_token(&sp));
436436
}
437437
else if (strcmp(tok, "Build") == 0) {
438438

@@ -446,7 +446,7 @@ link_fetch_hwinfo(struct link_pmc *lp)
446446

447447
sprintf(lp->hw.crc32 + strlen(lp->hw.crc32), " (%.16s)", tok);
448448

449-
sprintf(lp->hwinfo, "%.64s / %.32s", lp->hw.revision, lp->hw.crc32);
449+
sprintf(lp->hwinfo, "%.64s / %.32s", lp->hw.hardware, lp->hw.crc32);
450450
}
451451
}
452452

pgui/link.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,8 @@ struct link_pmc {
8989

9090
struct {
9191

92+
char hardware[LINK_NAME_MAX];
9293
char revision[LINK_NAME_MAX];
93-
char identify[LINK_NAME_MAX];
9494
char build[LINK_NAME_MAX];
9595
char crc32[LINK_NAME_MAX];
9696
}

pgui/phobia.c

Lines changed: 32 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -578,15 +578,15 @@ pub_popup_hwinfo(struct public *pub, int popup)
578578
nk_label(ctx, "HW revision", NK_TEXT_LEFT);
579579

580580
nk_edit_string_zero_terminated(ctx, NK_EDIT_SELECTABLE,
581-
lp->hw.revision, 79, nk_filter_default);
581+
lp->hw.hardware, 79, nk_filter_default);
582582

583583
nk_spacer(ctx);
584584

585585
nk_spacer(ctx);
586-
nk_label(ctx, "PMC firmware", NK_TEXT_LEFT);
586+
nk_label(ctx, "FW revision", NK_TEXT_LEFT);
587587

588588
nk_edit_string_zero_terminated(ctx, NK_EDIT_SELECTABLE,
589-
lp->hw.identify, 79, nk_filter_default);
589+
lp->hw.revision, 79, nk_filter_default);
590590

591591
nk_spacer(ctx);
592592

@@ -673,7 +673,7 @@ pub_popup_about(struct public *pub, int popup)
673673
#include "../src/hgdef.h"
674674

675675
nk_spacer(ctx);
676-
nk_label(ctx, "Identify: " _HG_IDENTIFY, NK_TEXT_LEFT);
676+
nk_label(ctx, "Revision: " _HG_REV, NK_TEXT_LEFT);
677677
nk_spacer(ctx);
678678

679679
nk_spacer(ctx);
@@ -4646,6 +4646,12 @@ page_lu_forced(struct public *pub)
46464646
nk_layout_row_dynamic(ctx, 0, 1);
46474647
nk_spacer(ctx);
46484648

4649+
reg_enum_toggle(pub, "pm.config_LU_FORCED", "FORCED control");
4650+
reg_enum_toggle(pub, "pm.config_LU_FREEWHEEL", "Allow FREEWHEELING");
4651+
4652+
nk_layout_row_dynamic(ctx, 0, 1);
4653+
nk_spacer(ctx);
4654+
46494655
reg_float(pub, "pm.forced_hold_D", "FORCED hold current");
46504656
reg_float(pub, "pm.forced_weak_D", "FORCED weak current");
46514657
reg_float_um(pub, "pm.forced_maximal", "Maximal forward speed", 1);
@@ -4714,6 +4720,11 @@ page_lu_flux(struct public *pub)
47144720
nk_layout_row_dynamic(ctx, 0, 1);
47154721
nk_spacer(ctx);
47164722

4723+
reg_enum_combo(pub, "pm.config_LU_ESTIMATE", "SENSORLESS estimate", 1);
4724+
4725+
nk_layout_row_dynamic(ctx, 0, 1);
4726+
nk_spacer(ctx);
4727+
47174728
reg_float(pub, "pm.detach_threshold", "DETACHED voltage threshold");
47184729
reg_float(pub, "pm.detach_trip_tol", "DETACHED trip tolerance");
47194730
reg_float(pub, "pm.detach_gain_SF", "DETACHED speed loop gain");
@@ -5160,6 +5171,11 @@ page_lu_eabi(struct public *pub)
51605171
nk_spacer(ctx);
51615172
}
51625173

5174+
reg_enum_combo(pub, "pm.config_EABI_FRONTEND", "EABI frontend", 0);
5175+
5176+
nk_layout_row_dynamic(ctx, 0, 1);
5177+
nk_spacer(ctx);
5178+
51635179
reg_float(pub, "pm.eabi_F0", "EABI adjustment position");
51645180
reg_float(pub, "pm.eabi_const_EP", "EABI pulse resolution");
51655181
reg_float(pub, "pm.eabi_const_Zs", "Gear teeth number S");
@@ -5324,6 +5340,11 @@ page_lu_sincos(struct public *pub)
53245340
nk_spacer(ctx);
53255341
}
53265342

5343+
reg_enum_combo(pub, "pm.config_SINCOS_FRONTEND", "SINCOS frontend", 0);
5344+
5345+
nk_layout_row_dynamic(ctx, 0, 1);
5346+
nk_spacer(ctx);
5347+
53275348
reg_float(pub, "pm.sincos_const_Zs", "Gear teeth number S");
53285349
reg_float(pub, "pm.sincos_const_Zq", "Gear teeth number Q");
53295350
reg_float(pub, "pm.sincos_gain_PF", "SINCOS position gain");
@@ -5517,7 +5538,8 @@ page_lp_current(struct public *pub)
55175538
nk_layout_row_dynamic(ctx, 0, 1);
55185539
nk_spacer(ctx);
55195540

5520-
reg_float(pub, "pm.i_maximal_on_HFI", "Maximal current on HFI");
5541+
reg_enum_toggle(pub, "pm.config_CC_BRAKE_STOP", "DRIVE brake (no reverse)");
5542+
reg_enum_toggle(pub, "pm.config_CC_SPEED_TRACK", "DRIVE speed tracking");
55215543

55225544
nk_layout_row_dynamic(ctx, 0, 1);
55235545
nk_spacer(ctx);
@@ -5691,6 +5713,11 @@ page_lp_location(struct public *pub)
56915713
nk_spacer(ctx);
56925714
}
56935715

5716+
reg_enum_combo(pub, "pm.config_LU_LOCATION", "Servo LOCATION source", 1);
5717+
5718+
nk_layout_row_dynamic(ctx, 0, 1);
5719+
nk_spacer(ctx);
5720+
56945721
reg = link_reg_lookup(lp, "pm.const_ld_Sm");
56955722
if (reg != NULL && reg->fval > 0.f) { um_def = 2; }
56965723

src/hal/drv.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77
#define HW_DRV_FREQUENCY 2000000U /* (Hz) */
88
#endif /* HW_DRV_FREQUENCY */
99

10-
#ifndef HW_DRV_FAULT_SAFETY
11-
#define HW_DRV_FAULT_SAFETY 20
12-
#endif /* HW_DRV_FAULT_SAFETY */
10+
#ifndef HW_DRV_FAULT_THRESHOLD
11+
#define HW_DRV_FAULT_THRESHOLD 20
12+
#endif /* HW_DRV_FAULT_THRESHOLD */
1313

1414
static int
1515
DRV_read_reg(int addr)
@@ -166,7 +166,7 @@ int DRV_fault()
166166
{
167167
if (hal.DRV.partno_ENABLED != DRV_NONE) {
168168

169-
if (unlikely(hal.DRV.fault_CNT >= HW_DRV_FAULT_SAFETY)) {
169+
if (unlikely(hal.DRV.fault_CNT >= HW_DRV_FAULT_THRESHOLD)) {
170170

171171
return HAL_FAULT;
172172
}

src/hal/entry.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#include "hal.h"
22
#include "cmsis/stm32xx.h"
33

4-
#define LD_VECTORS __attribute__ ((section(".vectors"), used))
4+
#define LD_VTABLE __attribute__ ((section(".vtab"), used))
55
#define LD_IRQ_WEAK __attribute__ ((weak, alias("irq_Weak")))
66

77
extern uint32_t ld_stack;
@@ -17,7 +17,7 @@ extern uint32_t ld_bss_begin;
1717
extern uint32_t ld_bss_end;
1818
extern uint32_t ld_ccm_begin;
1919
extern uint32_t ld_ccm_end;
20-
extern uint32_t ld_end;
20+
extern uint32_t ld_crc32_stub;
2121

2222
void irq_Reset();
2323
void irq_NMI();
@@ -49,14 +49,14 @@ void irq_OTG_FS() LD_IRQ_WEAK;
4949
const fw_info_t fw = {
5050

5151
(uint32_t) &ld_text_begin,
52-
(uint32_t) &ld_end,
52+
(uint32_t) &ld_crc32_stub,
5353

5454
#include "hgdef.h"
5555

56-
_HW_REV, _HG_IDENTIFY, __DATE__
56+
_HW_REV, _HG_REV, __DATE__
5757
};
5858

59-
LD_VECTORS void *vtab[] = {
59+
LD_VTABLE void *vtab[] = {
6060

6161
(void *) &ld_stack,
6262

src/hal/hal.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,8 @@ typedef struct {
102102
uint32_t ld_begin;
103103
uint32_t ld_crc32;
104104

105+
const char hardware[64];
105106
const char revision[64];
106-
const char identify[64];
107107
const char build[16];
108108
}
109109
fw_info_t;

src/hal/link_f405.ld

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ SECTIONS
1616
{
1717
ld_text_begin = . ;
1818

19-
KEEP(*(.vectors))
19+
KEEP(*(.vtab))
2020
. = ALIGN(8);
2121

2222
*(.text)
@@ -58,7 +58,7 @@ SECTIONS
5858

5959
.endstub (NOLOAD) : ALIGN(8)
6060
{
61-
ld_end = . ;
61+
ld_crc32_stub = . ;
6262

6363
} > FLASH
6464

src/hal/link_f722.ld

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ SECTIONS
1717
{
1818
ld_text_begin = . ;
1919

20-
KEEP(*(.vectors))
20+
KEEP(*(.vtab))
2121
. = ALIGN(8);
2222

2323
*(.text)
@@ -59,7 +59,7 @@ SECTIONS
5959

6060
.endstub (NOLOAD) : ALIGN(8)
6161
{
62-
ld_end = . ;
62+
ld_crc32_stub = . ;
6363

6464
} > ITCM_FLASH
6565

src/hgdef.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
#define _HG_IDENTIFY "default-f0d7782a1283-2025-04-12"
1+
#define _HG_REV "default-493-351435b63c2c (2025-04-15)"

src/main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1175,8 +1175,8 @@ SH_DEF(ap_version)
11751175
uint32_t ld_sizeof, ld_crc32;
11761176
int rc;
11771177

1178+
printf("Hardware \"%s\"" EOL, fw.hardware);
11781179
printf("Revision \"%s\"" EOL, fw.revision);
1179-
printf("Identify \"%s\"" EOL, fw.identify);
11801180
printf("Build \"%s\"" EOL, fw.build);
11811181

11821182
ld_sizeof = fw.ld_crc32 - fw.ld_begin;

0 commit comments

Comments
 (0)