Skip to content

Commit

Permalink
Merge pull request #884 from riscv/from_upstream
Browse files Browse the repository at this point in the history
Merge up to a3ed124 from upstream.
  • Loading branch information
timsifive authored Jul 31, 2023
2 parents 1997e68 + 674911e commit c07d925
Show file tree
Hide file tree
Showing 52 changed files with 4,965 additions and 1,273 deletions.
31 changes: 31 additions & 0 deletions contrib/loaders/flash/numicro/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# SPDX-License-Identifier: GPL-2.0-or-later

BIN2C = ../../../../src/helper/bin2char.sh

CROSS_COMPILE ?= arm-none-eabi-

CC=$(CROSS_COMPILE)gcc
OBJCOPY=$(CROSS_COMPILE)objcopy
OBJDUMP=$(CROSS_COMPILE)objdump


AFLAGS = -static -nostartfiles -mlittle-endian -Wa,-EL

all: numicro_m0.inc numicro_m4.inc

.PHONY: clean

%.elf: %.S
$(CC) $(AFLAGS) $< -o $@

%.lst: %.elf
$(OBJDUMP) -S $< > $@

%.bin: %.elf
$(OBJCOPY) -Obinary $< $@

%.inc: %.bin
$(BIN2C) < $< > $@

clean:
-rm -f *.elf *.lst *.bin *.inc
73 changes: 73 additions & 0 deletions contrib/loaders/flash/numicro/numicro_m0.S
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
/* SPDX-License-Identifier: GPL-2.0-or-later */

/***************************************************************************
* Copyright (C) 2015 Nemui Trinomius *
* [email protected] *
* *
* Copyright (C) 2017 Zale Yu *
* [email protected] *
* *
* Copyright (C) 2022 Jian-Hong Pan *
* [email protected] *
***************************************************************************/

.text
.cpu cortex-m0
.thumb

/* Params:
* r0 - workarea buffer / result
* r1 - target address
* r2 - wordcount
* Clobbered:
* r4 - tmp
* r5 - tmp
* r6 - tmp
* r7 - tmp
*/

.L1:
/* for(register uint32_t i=0;i<wcount;i++){ */
mov r4, r0
mov r3, #0
.L2:
sub r5, r1, r0
add r7, r4, r5
cmp r3, r2
beq .L7
.L4:
/* NUMICRO_FLASH_ISPADR = faddr; */
ldr r6, .L8
str r7, [r6]
/* NUMICRO_FLASH_ISPDAT = *pLW; */
ldmia r4!, {r7}
ldr r5, .L8+4
str r7, [r5]
/* faddr += 4; */
/* pLW++; */
/* Trigger write action */
/* NUMICRO_FLASH_ISPTRG = ISPTRG_ISPGO; */
ldr r5, .L8+8
mov r6, #1
str r6, [r5]
.L3:
/* while((NUMICRO_FLASH_ISPTRG & ISPTRG_ISPGO) == ISPTRG_ISPGO){}; */
ldr r7, [r5]
lsl r7, r7, #31
bmi .L3

add r3, r3, #1
b .L2
.L7:
/* return (NUMICRO_FLASH_ISPCON & ISPCON_ISPFF); */
ldr r3, .L8+12
ldr r0, [r3]
mov r1, #64
and r0, r1
.L9:
bkpt #0
.L8:
.word 0x5000C004
.word 0x5000C008
.word 0x5000C010
.word 0x5000C000
5 changes: 5 additions & 0 deletions contrib/loaders/flash/numicro/numicro_m0.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/* Autogenerated with ../../../../src/helper/bin2char.sh */
0x04,0x1c,0x00,0x23,0x0d,0x1a,0x67,0x19,0x93,0x42,0x0c,0xd0,0x08,0x4e,0x37,0x60,
0x80,0xcc,0x08,0x4d,0x2f,0x60,0x08,0x4d,0x01,0x26,0x2e,0x60,0x2f,0x68,0xff,0x07,
0xfc,0xd4,0x01,0x33,0xee,0xe7,0x05,0x4b,0x18,0x68,0x40,0x21,0x08,0x40,0x00,0xbe,
0x04,0xc0,0x00,0x50,0x08,0xc0,0x00,0x50,0x10,0xc0,0x00,0x50,0x00,0xc0,0x00,0x50,
70 changes: 70 additions & 0 deletions contrib/loaders/flash/numicro/numicro_m4.S
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
/* SPDX-License-Identifier: GPL-2.0-or-later */

/***************************************************************************
* Copyright (C) 2017 Zale Yu *
* [email protected] *
* *
* Copyright (C) 2022 Jian-Hong Pan *
* [email protected] *
***************************************************************************/

.text
.cpu cortex-m4
.thumb

/* Params:
* r0 - workarea buffer / result
* r1 - target address
* r2 - wordcount
* Clobbered:
* r4 - tmp
* r5 - tmp
* r6 - tmp
* r7 - tmp
*/

.L1:
/* for(register uint32_t i=0;i<wcount;i++){ */
mov r4, r0
mov r3, #0
.L2:
sub r5, r1, r0
add r7, r4, r5
cmp r3, r2
beq .L7
.L4:
/* NUMICRO_FLASH_ISPADR = faddr; */
ldr r6, .L8
str r7, [r6]
/* NUMICRO_FLASH_ISPDAT = *pLW; */
ldmia r4!, {r7}
ldr r5, .L8+4
str r7, [r5]
/* faddr += 4; */
/* pLW++; */
/* Trigger write action */
/* NUMICRO_FLASH_ISPTRG = ISPTRG_ISPGO; */
ldr r5, .L8+8
mov r6, #1
str r6, [r5]
.L3:
/* while((NUMICRO_FLASH_ISPTRG & ISPTRG_ISPGO) == ISPTRG_ISPGO){}; */
ldr r7, [r5]
lsl r7, r7, #31
bmi .L3

add r3, r3, #1
b .L2
.L7:
/* return (NUMICRO_FLASH_ISPCON & ISPCON_ISPFF); */
ldr r3, .L8+12
ldr r0, [r3]
mov r1, #64
and r0, r1
.L9:
bkpt #0
.L8:
.word 0x4000C004
.word 0x4000C008
.word 0x4000C010
.word 0x4000C000
5 changes: 5 additions & 0 deletions contrib/loaders/flash/numicro/numicro_m4.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/* Autogenerated with ../../../../src/helper/bin2char.sh */
0x04,0x1c,0x00,0x23,0x0d,0x1a,0x67,0x19,0x93,0x42,0x0c,0xd0,0x08,0x4e,0x37,0x60,
0x80,0xcc,0x08,0x4d,0x2f,0x60,0x08,0x4d,0x01,0x26,0x2e,0x60,0x2f,0x68,0xff,0x07,
0xfc,0xd4,0x01,0x33,0xee,0xe7,0x05,0x4b,0x18,0x68,0x40,0x21,0x08,0x40,0x00,0xbe,
0x04,0xc0,0x00,0x40,0x08,0xc0,0x00,0x40,0x10,0xc0,0x00,0x40,0x00,0xc0,0x00,0x40,
173 changes: 173 additions & 0 deletions doc/usb_adapters/cmsis_dap/04b4_f155_cypress_kitprog3.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,173 @@
# SPDX-License-Identifier: GPL-2.0-or-later OR GFDL-1.2-no-invariants-or-later

# KitProg3 Firmware 1.01
# Has inconsistent class code 0 for CMSIS-DAP interface

Bus 002 Device 017: ID 04b4:f155 Cypress Semiconductor Corp.
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 2.00
bDeviceClass 239 Miscellaneous Device
bDeviceSubClass 2 ?
bDeviceProtocol 1 Interface Association
bMaxPacketSize0 8
idVendor 0x04b4 Cypress Semiconductor Corp.
idProduct 0xf155
bcdDevice 1.01
iManufacturer 1 Cypress Semiconductor
iProduct 6 KitProg3 CMSIS-DAP
iSerial 128 102015B003137400
bNumConfigurations 1
Configuration Descriptor:
bLength 9
bDescriptorType 2
wTotalLength 130
bNumInterfaces 4
bConfigurationValue 1
iConfiguration 11 KitProg3 CMSIS-DAP
bmAttributes 0x80
(Bus Powered)
MaxPower 400mA
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 0
bAlternateSetting 0
bNumEndpoints 2
bInterfaceClass 0 (Defined at Interface level)
bInterfaceSubClass 0
bInterfaceProtocol 0
iInterface 6 KitProg3 CMSIS-DAP
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x01 EP 1 OUT
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0040 1x 64 bytes
bInterval 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x82 EP 2 IN
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0040 1x 64 bytes
bInterval 0
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 1
bAlternateSetting 0
bNumEndpoints 2
bInterfaceClass 3 Human Interface Device
bInterfaceSubClass 0 No Subclass
bInterfaceProtocol 0 None
iInterface 12 KitProg3 bridge
HID Device Descriptor:
bLength 9
bDescriptorType 33
bcdHID 1.11
bCountryCode 0 Not supported
bNumDescriptors 1
bDescriptorType 34 Report
wDescriptorLength 43
Report Descriptors:
** UNAVAILABLE **
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x86 EP 6 IN
bmAttributes 3
Transfer Type Interrupt
Synch Type None
Usage Type Data
wMaxPacketSize 0x0040 1x 64 bytes
bInterval 1
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x07 EP 7 OUT
bmAttributes 3
Transfer Type Interrupt
Synch Type None
Usage Type Data
wMaxPacketSize 0x0040 1x 64 bytes
bInterval 1
Interface Association:
bLength 8
bDescriptorType 11
bFirstInterface 2
bInterfaceCount 2
bFunctionClass 2 Communications
bFunctionSubClass 2 Abstract (modem)
bFunctionProtocol 0 None
iFunction 0
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 2
bAlternateSetting 0
bNumEndpoints 1
bInterfaceClass 2 Communications
bInterfaceSubClass 2 Abstract (modem)
bInterfaceProtocol 1 AT-commands (v.25ter)
iInterface 15 KitProg3 USBUART
CDC Header:
bcdCDC 1.10
CDC ACM:
bmCapabilities 0x02
line coding and serial state
CDC Union:
bMasterInterface 2
bSlaveInterface 3
CDC Call Management:
bmCapabilities 0x00
bDataInterface 3
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x83 EP 3 IN
bmAttributes 3
Transfer Type Interrupt
Synch Type None
Usage Type Data
wMaxPacketSize 0x0008 1x 8 bytes
bInterval 2
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 3
bAlternateSetting 0
bNumEndpoints 2
bInterfaceClass 10 CDC Data
bInterfaceSubClass 0 Unused
bInterfaceProtocol 0
iInterface 4 KitProg3 USBUART
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x84 EP 4 IN
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0040 1x 64 bytes
bInterval 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x05 EP 5 OUT
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0040 1x 64 bytes
bInterval 0
Device Status: 0x0000
(Bus Powered)
Loading

0 comments on commit c07d925

Please sign in to comment.