я думаю что я это сделал. добавил поддержку ядра bm310s6 и
процессор к1921вг015.
результат:
riscv32-kgp-elf-gcc --target-help
... Known valid arguments for -mcpu= option: sifive-e20 sifive-e21 sifive-e24 sifive-e31 sifive-e34 sifive-e76 sifive-s21 sifive-s51 sifive-s54 sifive-s76 sifive-u54 sifive-u74 sifive-x280 sifive-p450 sifive-p670 thead-c906 xt-c908 xt-c908v xt-c910 xt-c910v2 xt-c920 xt-c920v2 tt-ascalon-d8 xiangshan-nanhu xiangshan-kunminghu mips-p8700 gd32vf103 к1948вк018 k1948vk018 ch32v003 ch32m030 ch32v103 ch32l103 ch32v203 ch32v208 ch32x033 ch32x034 ch32x035 ch32v303 ch32v305 ch32v307 ch32v317 к1921вг015 k1921vg015 Known valid arguments for -mtune= option: rocket sifive-3-series sifive-5-series sifive-7-series sifive-p400-series sifive-p600-series tt-ascalon-d8 thead-c906 xt-c908 xt-c908v xt-c910 xt-c910v2 xt-c920 xt-c920v2 xiangshan-nanhu xiangshan-kunminghu generic-ooo size mips-p8700 bumblebee scr1 qkv2a qkv3a qkv3b qkv3c qkv4a qkv4b qkv4c qkv4f cloudbear-bm310s6 sifive-e20 sifive-e21 sifive-e24 sifive-e31 sifive-e34 sifive-e76 sifive-s21 sifive-s51 sifive-s54 sifive-s76 sifive-u54 sifive-u74 sifive-x280 sifive-p450 sifive-p670 gd32vf103 к1948вк018 k1948vk018 ch32v003 ch32m030 ch32v103 ch32l103 ch32v203 ch32v208 ch32x033 ch32x034 ch32x035 ch32v303 ch32v305 ch32v307 ch32v317 к1921вг015 k1921vg015 ...
выход кодогенератора:
тестовый исходник для проверки test.c
/* тест кодогенератора на инструкций cpop/ctz/rol (расширение ZBB)*/ int popcount(const int z) { return __builtin_popcount(z) ; } int ctz(const int z) { return __builtin_ctz(z) ; } unsigned roll (const unsigned z, const int v) { return (z << v) | (z >> (32 - v)) ; } /* тест кодогенератора на использование инструкций битового процессора (расширение ZBS) */ int bit_set(const int z, const int v ) { return z | (1 << v) ; } int bit_clear(const int z, const int v ) { return z & ~(1 << v) ; } int bit_inv(const int z, const int v ) { return z ^ (1 << v) ; } /* тест кодогенератора на использование инструкций mod/umod */ int mod(const int z, const int v ) { return z % v ; } /* тест кодогенератора на использование инструкций mret/uret/sret стандартная генерация эпилога пролога */ __attribute__((aligned(4),interrupt)) void machine_mode_interruot_handler() { asm volatile ("aupic ra, 0x10" : : : "ra"); } __attribute__((aligned(4),interrupt("user"))) void user_mode_interruot_handler() { asm volatile ("aupic ra, 0x10" : : : "ra"); } __attribute__((aligned(4),interrupt("supervisor"))) void supervisor_mode_interruot_handler() { asm volatile ("aupic ra, 0x10" : : : "ra"); } /* тест кодогенератора на использование инструкций mret/uret апаратное сохранение контекста ( реализовано в ch32v3xx ) */ __attribute__((aligned(4),interrupt("machine_hpe"))) void machine_mode_hpe_interruot_handler() { asm volatile ("aupic ra, 0x10" : : : "ra"); }
riscv32-kgp-elf-gcc -Os -c a.c -S -mcpu=ch32v303 -mabi=ilp32f
.file "test.c" .option nopic .attribute arch, "rv32i2p1_m2p0_a2p1_f2p2_c2p0_zicsr2p0_zmmul1p0_zaamo1p0_zalrsc1p0_zca1p0_zcf1p0" .attribute unaligned_access, 1 .attribute stack_align, 16 .text .align 1 .globl popcount .type popcount, @function popcount: addi sp,sp,-16 sw ra,12(sp) call __popcountsi2 lw ra,12(sp) addi sp,sp,16 jr ra .size popcount, .-popcount .align 1 .globl ctz .type ctz, @function ctz: addi sp,sp,-16 sw ra,12(sp) call __ctzsi2 lw ra,12(sp) addi sp,sp,16 jr ra .size ctz, .-ctz .align 1 .globl roll .type roll, @function roll: sll a5,a0,a1 neg a1,a1 srl a0,a0,a1 or a0,a0,a5 ret .size roll, .-roll .align 1 .globl bit_set .type bit_set, @function bit_set: li a5,1 sll a5,a5,a1 or a0,a5,a0 ret .size bit_set, .-bit_set .align 1 .globl bit_clear .type bit_clear, @function bit_clear: li a5,1 sll a5,a5,a1 not a5,a5 and a0,a5,a0 ret .size bit_clear, .-bit_clear .align 1 .globl bit_inv .type bit_inv, @function bit_inv: li a5,1 sll a5,a5,a1 xor a0,a5,a0 ret .size bit_inv, .-bit_inv .align 1 .globl mod .type mod, @function mod: rem a0,a0,a1 ret .size mod, .-mod .align 2 .globl machine_mode_interruot_handler .type machine_mode_interruot_handler, @function machine_mode_interruot_handler: addi sp,sp,-16 sw ra,12(sp) sw t0,8(sp) #APP # 27 "a.c" 1 aupic ra, 0x10 # 0 "" 2 #NO_APP lw ra,12(sp) lw t0,8(sp) addi sp,sp,16 mret .size machine_mode_interruot_handler, .-machine_mode_interruot_handler .align 2 .globl user_mode_interruot_handler .type user_mode_interruot_handler, @function user_mode_interruot_handler: addi sp,sp,-16 sw ra,12(sp) sw t0,8(sp) #APP # 27 "a.c" 1 aupic ra, 0x10 # 0 "" 2 #NO_APP lw ra,12(sp) lw t0,8(sp) addi sp,sp,16 uret .size user_mode_interruot_handler, .-user_mode_interruot_handler .align 2 .globl supervisor_mode_interruot_handler .type supervisor_mode_interruot_handler, @function supervisor_mode_interruot_handler: addi sp,sp,-16 sw ra,12(sp) sw t0,8(sp) #APP # 27 "a.c" 1 aupic ra, 0x10 # 0 "" 2 #NO_APP lw ra,12(sp) lw t0,8(sp) addi sp,sp,16 sret .size supervisor_mode_interruot_handler, .-supervisor_mode_interruot_handler .align 2 .globl machine_mode_hpe_interruot_handler .type machine_mode_hpe_interruot_handler, @function machine_mode_hpe_interruot_handler: addi sp,sp,-16 sw t0,12(sp) #APP # 27 "a.c" 1 aupic ra, 0x10 # 0 "" 2 #NO_APP addi sp,sp,16 mret .size machine_mode_hpe_interruot_handler, .-machine_mode_hpe_interruot_handler .globl __ctzsi2 .globl __popcountsi2 .ident "GCC: (Klen's_GNU_package_(KGP)_for_target::riscv32-kgp-elf(ilp32/ilp32f/medlow/Os/Ofast/lto)_host::x86_64-kgp-linux-gnu_haswell-avx2<<lespedeza>>) 16.0.0 20250618 (experimental)" .section .note.GNU-stack,"",@progbits
c втыканием -mcpu=к1921вг015 кодогенератор подключает генераци. инструкций из расширений ZBA ZBB ZBC ZBS
riscv32-kgp-elf-gcc -Os -c test.c -S -mcpu=к1921вг015 -mabi=ilp32f
.file "test.c" .option nopic .attribute arch, "rv32i2p1_m2p0_f2p2_c2p0_b1p0_zicsr2p0_zmmul1p0_zca1p0_zcf1p0_zba1p0_zbb1p0_zbc1p0_zbs1p0" .attribute unaligned_access, 1 .attribute stack_align, 16 .text .align 1 .globl popcount .type popcount, @function popcount: cpop a0,a0 ret .size popcount, .-popcount .align 1 .globl ctz .type ctz, @function ctz: ctz a0,a0 ret .size ctz, .-ctz .align 1 .globl roll .type roll, @function roll: rol a0,a0,a1 ret .size roll, .-roll .align 1 .globl bit_set .type bit_set, @function bit_set: bset a0,a0,a1 ret .size bit_set, .-bit_set .align 1 .globl bit_clear .type bit_clear, @function bit_clear: bclr a0,a0,a1 ret .size bit_clear, .-bit_clear .align 1 .globl bit_inv .type bit_inv, @function bit_inv: binv a0,a0,a1 ret .size bit_inv, .-bit_inv .align 1 .globl mod .type mod, @function mod: rem a0,a0,a1 ret .size mod, .-mod .align 2 .globl machine_mode_interruot_handler .type machine_mode_interruot_handler, @function machine_mode_interruot_handler: addi sp,sp,-16 sw ra,12(sp) sw t0,8(sp) #APP # 27 "a.c" 1 aupic ra, 0x10 # 0 "" 2 #NO_APP lw ra,12(sp) lw t0,8(sp) addi sp,sp,16 mret .size machine_mode_interruot_handler, .-machine_mode_interruot_handler .align 2 .globl user_mode_interruot_handler .type user_mode_interruot_handler, @function user_mode_interruot_handler: addi sp,sp,-16 sw ra,12(sp) sw t0,8(sp) #APP # 27 "a.c" 1 aupic ra, 0x10 # 0 "" 2 #NO_APP lw ra,12(sp) lw t0,8(sp) addi sp,sp,16 uret .size user_mode_interruot_handler, .-user_mode_interruot_handler .align 2 .globl supervisor_mode_interruot_handler .type supervisor_mode_interruot_handler, @function supervisor_mode_interruot_handler: addi sp,sp,-16 sw ra,12(sp) sw t0,8(sp) #APP # 27 "a.c" 1 aupic ra, 0x10 # 0 "" 2 #NO_APP lw ra,12(sp) lw t0,8(sp) addi sp,sp,16 sret .size supervisor_mode_interruot_handler, .-supervisor_mode_interruot_handler .align 2 .globl machine_mode_hpe_interruot_handler .type machine_mode_hpe_interruot_handler, @function machine_mode_hpe_interruot_handler: addi sp,sp,-16 sw t0,12(sp) #APP # 27 "a.c" 1 aupic ra, 0x10 # 0 "" 2 #NO_APP addi sp,sp,16 mret .size machine_mode_hpe_interruot_handler, .-machine_mode_hpe_interruot_handler .ident "GCC: (Klen's_GNU_package_(KGP)_for_target::riscv32-kgp-elf(ilp32/ilp32f/medlow/Os/Ofast/lto)_host::x86_64-kgp-linux-gnu_haswell-avx2<<lespedeza>>) 16.0.0 20250618 (experimental)" .section .note.GNU-stack,"",@progbits
для наглядности diff для -mcpu=к1921вг015 и -mcpu=ch32v303
-
- Можно понимать это так, что обновлённая сборка залита по той же ссылке и можно качать? Или будет другая ссылка? - Nikolay_Po(Сегодня, 02:28)