Skip to content

Commit 864055b

Browse files
authored
[fixup] aarch64 UMP compiler error (#8677)
Signed-off-by: Shell <[email protected]>
1 parent 6d1bc9b commit 864055b

File tree

11 files changed

+30
-24
lines changed

11 files changed

+30
-24
lines changed

components/drivers/ofw/base.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -1474,7 +1474,7 @@ static const char *ofw_get_prop_fuzzy_name(const struct rt_ofw_node *np, const c
14741474
char *sf, split_field[64];
14751475
rt_size_t len = 0, max_ak = 0;
14761476
const char *str, *result = RT_NULL;
1477-
RT_BITMAP_DECLARE(ak, sizeof(split_field));
1477+
RT_BITMAP_DECLARE(ak, sizeof(split_field)) = {0};
14781478
struct rt_ofw_prop *prop;
14791479

14801480
/*

components/drivers/ofw/irq.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -624,7 +624,7 @@ int rt_ofw_get_irq(struct rt_ofw_node *np, int index)
624624

625625
if ((rt_int64_t)cpuid >= 0)
626626
{
627-
RT_DECLARE_BITMAP(affinity, RT_CPUS_NR) = { 0 };
627+
RT_BITMAP_DECLARE(affinity, RT_CPUS_NR) = { 0 };
628628

629629
rt_bitmap_set_bit(affinity, cpuid);
630630

components/drivers/pic/pic_rthw.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ void rt_hw_interrupt_uninstall(int vector, rt_isr_handler_t handler, void *param
6666
#if defined(RT_USING_SMP) || defined(RT_USING_AMP)
6767
void rt_hw_ipi_send(int ipi_vector, unsigned int cpu_mask)
6868
{
69-
RT_DECLARE_BITMAP(cpu_masks, RT_CPUS_NR) = { cpu_mask };
69+
RT_BITMAP_DECLARE(cpu_masks, RT_CPUS_NR) = { cpu_mask };
7070

7171
rt_pic_irq_send_ipi(ipi_vector, cpu_masks);
7272
}

components/libc/compilers/common/ctime.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -879,7 +879,8 @@ static void rtthread_timer_wrapper(void *timerobj)
879879
}
880880
#ifdef RT_USING_SMART
881881
/* this field is named as tid in musl */
882-
int tid = *(int *)&timer->sigev_notify_function;
882+
void *ptid = &timer->sigev_notify_function;
883+
int tid = *(int *)ptid;
883884
struct lwp_timer_event_param *data = rt_container_of(timer->work, struct lwp_timer_event_param, work);
884885
data->signo = timer->sigev_signo;
885886

components/lwp/lwp_internal.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ static rt_err_t _mutex_take_safe(rt_mutex_t mtx, rt_int32_t timeout, int flags)
8989
}
9090
else
9191
{
92-
rc = -RT_EINVAL;
92+
rc = -RT_ERROR;
9393
LOG_W("%s: mtx should not be NULL", __func__);
9494
RT_ASSERT(0);
9595
}

components/lwp/lwp_syscall.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -2700,7 +2700,7 @@ sysret_t sys_execve(const char *path, char *const argv[], char *const envp[])
27002700
*/
27012701
RT_ASSERT(rt_list_entry(lwp->t_grp.prev, struct rt_thread, sibling) == thread);
27022702

2703-
strncpy(thread->parent.name, run_name + last_backslash, RT_NAME_MAX);
2703+
strncpy(thread->parent.name, run_name + last_backslash, RT_NAME_MAX - 1);
27042704
strncpy(lwp->cmd, new_lwp->cmd, RT_NAME_MAX);
27052705
rt_free(lwp->exe_file);
27062706
lwp->exe_file = strndup(new_lwp->exe_file, DFS_PATH_MAX);

components/mm/mm_page.c

+4-4
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ static void _collect()
109109
rt_page_t page = _trace_head;
110110
if (!page)
111111
{
112-
LOG_RAW("ok! ALLOC CNT %ld\n", _alloc_cnt);
112+
rt_kprintf("ok! ALLOC CNT %ld\n", _alloc_cnt);
113113
}
114114
else
115115
{
@@ -159,7 +159,7 @@ void _report(rt_page_t page, size_t size_bits, char *msg)
159159
{
160160
void *pg_va = rt_page_page2addr(page);
161161
LOG_W("%s: %p, allocator: %p, size bits: %lx", msg, pg_va, page->caller, page->trace_size);
162-
LOG_RAW("backtrace\n");
162+
rt_kprintf("backtrace\n");
163163
rt_backtrace();
164164
}
165165

@@ -175,7 +175,7 @@ static void _trace_free(rt_page_t page, void *caller, size_t size_bits)
175175
}
176176
else if (page->trace_size != size_bits)
177177
{
178-
LOG_RAW("free with size bits %lx\n", size_bits);
178+
rt_kprintf("free with size bits %lx\n", size_bits);
179179
_report(page, size_bits, "incompatible size bits parameter");
180180
return ;
181181
}
@@ -636,7 +636,7 @@ void list_page(void)
636636
rt_kprintf("[0x%08p]", rt_page_page2addr(hp));
637637
hp = hp->next;
638638
}
639-
LOG_RAW("\n");
639+
rt_kprintf("\n");
640640
}
641641

642642
rt_spin_unlock_irqrestore(&_spinlock, level);

libcpu/aarch64/common/SConscript

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ if GetDepend('RT_USING_OFW') == False:
1212
SrcRemove(src, ['setup.c', 'cpu_psci.c', 'psci.c'])
1313

1414
if GetDepend('RT_USING_PIC') == True:
15-
SrcRemove(src, ['gicv3.c', 'gic.c', 'interrupt.c', 'gtimer.c'])
16-
15+
SrcRemove(src, ['gicv3.c', 'gic.c', 'gtimer.c'])
16+
1717
group = DefineGroup('libcpu', src, depend = [''], CPPPATH = CPPPATH)
1818

1919
# build for sub-directory

libcpu/aarch64/common/interrupt.c

+13-10
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,18 @@
1616
#include "gicv3.h"
1717
#include "ioremap.h"
1818

19-
20-
/* exception and interrupt handler table */
21-
struct rt_irq_desc isr_table[MAX_HANDLERS];
22-
2319
#ifndef RT_USING_SMP
2420
/* Those variables will be accessed in ISR, so we need to share them. */
2521
rt_ubase_t rt_interrupt_from_thread = 0;
2622
rt_ubase_t rt_interrupt_to_thread = 0;
2723
rt_ubase_t rt_thread_switch_interrupt_flag = 0;
2824
#endif
2925

26+
#ifndef RT_USING_PIC
27+
28+
/* exception and interrupt handler table */
29+
struct rt_irq_desc isr_table[MAX_HANDLERS];
30+
3031
#ifndef RT_CPUS_NR
3132
#define RT_CPUS_NR 1
3233
#endif
@@ -138,17 +139,17 @@ void rt_hw_interrupt_mask(int vector)
138139
#ifdef SOC_BCM283x
139140
if (vector < 32)
140141
{
141-
IRQ_DISABLE1 = (1 << vector);
142+
IRQ_DISABLE1 = (1UL << vector);
142143
}
143144
else if (vector < 64)
144145
{
145146
vector = vector % 32;
146-
IRQ_DISABLE2 = (1 << vector);
147+
IRQ_DISABLE2 = (1UL << vector);
147148
}
148149
else
149150
{
150151
vector = vector - 64;
151-
IRQ_DISABLE_BASIC = (1 << vector);
152+
IRQ_DISABLE_BASIC = (1UL << vector);
152153
}
153154
#else
154155
arm_gic_mask(0, vector);
@@ -164,17 +165,17 @@ void rt_hw_interrupt_umask(int vector)
164165
#ifdef SOC_BCM283x
165166
if (vector < 32)
166167
{
167-
IRQ_ENABLE1 = (1 << vector);
168+
IRQ_ENABLE1 = (1UL << vector);
168169
}
169170
else if (vector < 64)
170171
{
171172
vector = vector % 32;
172-
IRQ_ENABLE2 = (1 << vector);
173+
IRQ_ENABLE2 = (1UL << vector);
173174
}
174175
else
175176
{
176177
vector = vector - 64;
177-
IRQ_ENABLE_BASIC = (1 << vector);
178+
IRQ_ENABLE_BASIC = (1UL << vector);
178179
}
179180
#else
180181
arm_gic_umask(0, vector);
@@ -416,6 +417,8 @@ void rt_hw_ipi_handler_install(int ipi_vector, rt_isr_handler_t ipi_isr_handler)
416417
}
417418
#endif
418419

420+
#endif /* RT_USING_PIC */
421+
419422
#if defined(FINSH_USING_MSH) && defined(RT_USING_INTERRUPT_INFO)
420423
int list_isr()
421424
{

libcpu/aarch64/common/mmu.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -688,6 +688,7 @@ static unsigned long *_query(rt_aspace_t aspace, void *vaddr, int *plvl_shf)
688688

689689
if (!(cur_lv_tbl[off] & MMU_TYPE_USED))
690690
{
691+
*plvl_shf = level_shift;
691692
return (void *)0;
692693
}
693694

@@ -707,11 +708,11 @@ static unsigned long *_query(rt_aspace_t aspace, void *vaddr, int *plvl_shf)
707708
off &= MMU_LEVEL_MASK;
708709
page = cur_lv_tbl[off];
709710

711+
*plvl_shf = level_shift;
710712
if (!(page & MMU_TYPE_USED))
711713
{
712714
return (void *)0;
713715
}
714-
*plvl_shf = level_shift;
715716
return &cur_lv_tbl[off];
716717
}
717718

tools/ci/cpp_check.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,10 @@ def check(self):
2727
[
2828
'cppcheck',
2929
'-DRT_ASSERT(x)=',
30-
'-Drt_list_for_each_entry(a,b,c)=a=(void*)b',
30+
'-Drt_list_for_each_entry(a,b,c)=a=(void*)b;',
3131
'-I include',
3232
'-I thread/components/finsh',
33+
# it's okay because CI will do the real compilation to check this
3334
'--suppress=syntaxError',
3435
'--enable=warning',
3536
'performance',

0 commit comments

Comments
 (0)