added riscv64-unknown toolchain

stable
penguin 3 years ago
parent 0f534f8a55
commit 5dd0775dc4

@ -3,6 +3,9 @@ common = "arch/arm/common"
mcu = "arch/arm/SAMD21/SAMD21A/mcu/"
ld = "arch/arm/SAMD21/SAMD21A/ld/"
cfg = "arch/arm/SAMD21/SAMD21A/manifest/"
[esf.includes]
IGLOO_INCLUDES = ["sam.h"]
# These are defaults. Once a project is generated, the .cfg can be freely edited without fear of anything being overwritten. However, I do not recommend editing any of the _cfg variables.
[esf.openocd]
scripts = "arch/arm/SAMD21/SAMD21A/scripts/"

@ -0,0 +1,108 @@
../../../ESF/mcu/src/startup_samd21j18a.d \
../../../ESF/mcu/src/startup_samd21j18a.o: \
../../../ESF/mcu/src/startup_samd21j18a.c \
../../../ESF/mcu/inc/samd21j18a.h \
/storage/Shared/Documents/Projects/ePenguin/ePenguin-Software-Framework/toolchains/arm/lib/gcc/arm-none-eabi/6.3.1/include/stdint.h \
/storage/Shared/Documents/Projects/ePenguin/ePenguin-Software-Framework/toolchains/arm/arm-none-eabi/include/stdint.h \
/storage/Shared/Documents/Projects/ePenguin/ePenguin-Software-Framework/toolchains/arm/arm-none-eabi/include/machine/_default_types.h \
/storage/Shared/Documents/Projects/ePenguin/ePenguin-Software-Framework/toolchains/arm/arm-none-eabi/include/sys/features.h \
/storage/Shared/Documents/Projects/ePenguin/ePenguin-Software-Framework/toolchains/arm/arm-none-eabi/include/_newlib_version.h \
/storage/Shared/Documents/Projects/ePenguin/ePenguin-Software-Framework/toolchains/arm/arm-none-eabi/include/sys/_intsup.h \
/storage/Shared/Documents/Projects/ePenguin/ePenguin-Software-Framework/toolchains/arm/arm-none-eabi/include/sys/_stdint.h \
../../../ESF/common/inc/cmsis/core_cm0plus.h \
../../../ESF/common/inc/cmsis/cmsis_version.h \
../../../ESF/common/inc/cmsis/cmsis_compiler.h \
../../../ESF/common/inc/cmsis/cmsis_gcc.h \
../../../ESF/mcu/inc/component/ac.h ../../../ESF/mcu/inc/component/adc.h \
../../../ESF/mcu/inc/component/dac.h \
../../../ESF/mcu/inc/component/dmac.h \
../../../ESF/mcu/inc/component/dsu.h \
../../../ESF/mcu/inc/component/eic.h \
../../../ESF/mcu/inc/component/evsys.h \
../../../ESF/mcu/inc/component/gclk.h \
../../../ESF/mcu/inc/component/hmatrixb.h \
../../../ESF/mcu/inc/component/i2s.h \
../../../ESF/mcu/inc/component/mtb.h \
../../../ESF/mcu/inc/component/nvmctrl.h \
../../../ESF/mcu/inc/component/pac.h ../../../ESF/mcu/inc/component/pm.h \
../../../ESF/mcu/inc/component/port.h \
../../../ESF/mcu/inc/component/ptc.h \
../../../ESF/mcu/inc/component/rtc.h \
../../../ESF/mcu/inc/component/sercom.h \
../../../ESF/mcu/inc/component/sysctrl.h \
../../../ESF/mcu/inc/component/tc.h ../../../ESF/mcu/inc/component/tcc.h \
../../../ESF/mcu/inc/component/usb.h \
../../../ESF/mcu/inc/component/wdt.h \
../../../ESF/mcu/inc/pio/samd21j18a.h
../../../ESF/mcu/inc/samd21j18a.h:
/storage/Shared/Documents/Projects/ePenguin/ePenguin-Software-Framework/toolchains/arm/lib/gcc/arm-none-eabi/6.3.1/include/stdint.h:
/storage/Shared/Documents/Projects/ePenguin/ePenguin-Software-Framework/toolchains/arm/arm-none-eabi/include/stdint.h:
/storage/Shared/Documents/Projects/ePenguin/ePenguin-Software-Framework/toolchains/arm/arm-none-eabi/include/machine/_default_types.h:
/storage/Shared/Documents/Projects/ePenguin/ePenguin-Software-Framework/toolchains/arm/arm-none-eabi/include/sys/features.h:
/storage/Shared/Documents/Projects/ePenguin/ePenguin-Software-Framework/toolchains/arm/arm-none-eabi/include/_newlib_version.h:
/storage/Shared/Documents/Projects/ePenguin/ePenguin-Software-Framework/toolchains/arm/arm-none-eabi/include/sys/_intsup.h:
/storage/Shared/Documents/Projects/ePenguin/ePenguin-Software-Framework/toolchains/arm/arm-none-eabi/include/sys/_stdint.h:
../../../ESF/common/inc/cmsis/core_cm0plus.h:
../../../ESF/common/inc/cmsis/cmsis_version.h:
../../../ESF/common/inc/cmsis/cmsis_compiler.h:
../../../ESF/common/inc/cmsis/cmsis_gcc.h:
../../../ESF/mcu/inc/component/ac.h:
../../../ESF/mcu/inc/component/adc.h:
../../../ESF/mcu/inc/component/dac.h:
../../../ESF/mcu/inc/component/dmac.h:
../../../ESF/mcu/inc/component/dsu.h:
../../../ESF/mcu/inc/component/eic.h:
../../../ESF/mcu/inc/component/evsys.h:
../../../ESF/mcu/inc/component/gclk.h:
../../../ESF/mcu/inc/component/hmatrixb.h:
../../../ESF/mcu/inc/component/i2s.h:
../../../ESF/mcu/inc/component/mtb.h:
../../../ESF/mcu/inc/component/nvmctrl.h:
../../../ESF/mcu/inc/component/pac.h:
../../../ESF/mcu/inc/component/pm.h:
../../../ESF/mcu/inc/component/port.h:
../../../ESF/mcu/inc/component/ptc.h:
../../../ESF/mcu/inc/component/rtc.h:
../../../ESF/mcu/inc/component/sercom.h:
../../../ESF/mcu/inc/component/sysctrl.h:
../../../ESF/mcu/inc/component/tc.h:
../../../ESF/mcu/inc/component/tcc.h:
../../../ESF/mcu/inc/component/usb.h:
../../../ESF/mcu/inc/component/wdt.h:
../../../ESF/mcu/inc/pio/samd21j18a.h:

@ -0,0 +1,108 @@
../../../ESF/mcu/src/system_samd21j18a.d \
../../../ESF/mcu/src/system_samd21j18a.o: \
../../../ESF/mcu/src/system_samd21j18a.c \
../../../ESF/mcu/inc/samd21j18a.h \
/storage/Shared/Documents/Projects/ePenguin/ePenguin-Software-Framework/toolchains/arm/lib/gcc/arm-none-eabi/6.3.1/include/stdint.h \
/storage/Shared/Documents/Projects/ePenguin/ePenguin-Software-Framework/toolchains/arm/arm-none-eabi/include/stdint.h \
/storage/Shared/Documents/Projects/ePenguin/ePenguin-Software-Framework/toolchains/arm/arm-none-eabi/include/machine/_default_types.h \
/storage/Shared/Documents/Projects/ePenguin/ePenguin-Software-Framework/toolchains/arm/arm-none-eabi/include/sys/features.h \
/storage/Shared/Documents/Projects/ePenguin/ePenguin-Software-Framework/toolchains/arm/arm-none-eabi/include/_newlib_version.h \
/storage/Shared/Documents/Projects/ePenguin/ePenguin-Software-Framework/toolchains/arm/arm-none-eabi/include/sys/_intsup.h \
/storage/Shared/Documents/Projects/ePenguin/ePenguin-Software-Framework/toolchains/arm/arm-none-eabi/include/sys/_stdint.h \
../../../ESF/common/inc/cmsis/core_cm0plus.h \
../../../ESF/common/inc/cmsis/cmsis_version.h \
../../../ESF/common/inc/cmsis/cmsis_compiler.h \
../../../ESF/common/inc/cmsis/cmsis_gcc.h \
../../../ESF/mcu/inc/component/ac.h ../../../ESF/mcu/inc/component/adc.h \
../../../ESF/mcu/inc/component/dac.h \
../../../ESF/mcu/inc/component/dmac.h \
../../../ESF/mcu/inc/component/dsu.h \
../../../ESF/mcu/inc/component/eic.h \
../../../ESF/mcu/inc/component/evsys.h \
../../../ESF/mcu/inc/component/gclk.h \
../../../ESF/mcu/inc/component/hmatrixb.h \
../../../ESF/mcu/inc/component/i2s.h \
../../../ESF/mcu/inc/component/mtb.h \
../../../ESF/mcu/inc/component/nvmctrl.h \
../../../ESF/mcu/inc/component/pac.h ../../../ESF/mcu/inc/component/pm.h \
../../../ESF/mcu/inc/component/port.h \
../../../ESF/mcu/inc/component/ptc.h \
../../../ESF/mcu/inc/component/rtc.h \
../../../ESF/mcu/inc/component/sercom.h \
../../../ESF/mcu/inc/component/sysctrl.h \
../../../ESF/mcu/inc/component/tc.h ../../../ESF/mcu/inc/component/tcc.h \
../../../ESF/mcu/inc/component/usb.h \
../../../ESF/mcu/inc/component/wdt.h \
../../../ESF/mcu/inc/pio/samd21j18a.h
../../../ESF/mcu/inc/samd21j18a.h:
/storage/Shared/Documents/Projects/ePenguin/ePenguin-Software-Framework/toolchains/arm/lib/gcc/arm-none-eabi/6.3.1/include/stdint.h:
/storage/Shared/Documents/Projects/ePenguin/ePenguin-Software-Framework/toolchains/arm/arm-none-eabi/include/stdint.h:
/storage/Shared/Documents/Projects/ePenguin/ePenguin-Software-Framework/toolchains/arm/arm-none-eabi/include/machine/_default_types.h:
/storage/Shared/Documents/Projects/ePenguin/ePenguin-Software-Framework/toolchains/arm/arm-none-eabi/include/sys/features.h:
/storage/Shared/Documents/Projects/ePenguin/ePenguin-Software-Framework/toolchains/arm/arm-none-eabi/include/_newlib_version.h:
/storage/Shared/Documents/Projects/ePenguin/ePenguin-Software-Framework/toolchains/arm/arm-none-eabi/include/sys/_intsup.h:
/storage/Shared/Documents/Projects/ePenguin/ePenguin-Software-Framework/toolchains/arm/arm-none-eabi/include/sys/_stdint.h:
../../../ESF/common/inc/cmsis/core_cm0plus.h:
../../../ESF/common/inc/cmsis/cmsis_version.h:
../../../ESF/common/inc/cmsis/cmsis_compiler.h:
../../../ESF/common/inc/cmsis/cmsis_gcc.h:
../../../ESF/mcu/inc/component/ac.h:
../../../ESF/mcu/inc/component/adc.h:
../../../ESF/mcu/inc/component/dac.h:
../../../ESF/mcu/inc/component/dmac.h:
../../../ESF/mcu/inc/component/dsu.h:
../../../ESF/mcu/inc/component/eic.h:
../../../ESF/mcu/inc/component/evsys.h:
../../../ESF/mcu/inc/component/gclk.h:
../../../ESF/mcu/inc/component/hmatrixb.h:
../../../ESF/mcu/inc/component/i2s.h:
../../../ESF/mcu/inc/component/mtb.h:
../../../ESF/mcu/inc/component/nvmctrl.h:
../../../ESF/mcu/inc/component/pac.h:
../../../ESF/mcu/inc/component/pm.h:
../../../ESF/mcu/inc/component/port.h:
../../../ESF/mcu/inc/component/ptc.h:
../../../ESF/mcu/inc/component/rtc.h:
../../../ESF/mcu/inc/component/sercom.h:
../../../ESF/mcu/inc/component/sysctrl.h:
../../../ESF/mcu/inc/component/tc.h:
../../../ESF/mcu/inc/component/tcc.h:
../../../ESF/mcu/inc/component/usb.h:
../../../ESF/mcu/inc/component/wdt.h:
../../../ESF/mcu/inc/pio/samd21j18a.h:

@ -0,0 +1,12 @@
#
# ePenguin Generated OpenOCD Config Script
#
# Transport Select
source [find interface//jlink.cfg]
transport select swd
# Chip Information
set CHIPNAME samd21j18a
source [find target//at91samdXX.cfg]

@ -6,3 +6,12 @@ cfg = "arch/arm/SAMD51/SAMD51A/manifest"
[esf.includes]
IGLOO_INCLUDES = ["sam.h"]
# These are defaults. Once a project is generated, the .cfg can be freely edited without fear
# of anything being overwritten. However, I do not recommend editing any of the _cfg variables# .
[esf.openocd]
chip_name = ""
chip_name_cfg = "atsame5x"
transport_cfg = "jlink"
transport = "swd"

@ -0,0 +1,130 @@
/*
* Copyright (c) 2017, Alex Taradov <alex@taradov.com>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
OUTPUT_ARCH("riscv")
MEMORY
{
flash (rxai!w) : ORIGIN = 0x20400000, LENGTH = 16M
ram (wxa!ri) : ORIGIN = 0x80000000, LENGTH = 16K
}
PHDRS
{
flash PT_LOAD;
ram_init PT_LOAD;
ram PT_NULL;
}
ENTRY(_start)
__top_flash = ORIGIN(flash) + LENGTH(flash);
__top_ram = ORIGIN(ram) + LENGTH(ram);
SECTIONS
{
.text :
{
KEEP (*(.init._start))
KEEP (*(.init.reset_handler))
KEEP (*(SORT_NONE(.init)))
*(.text.unlikely .text.unlikely.*)
*(.text.startup .text.startup.*)
*(.text .text.*)
*(.gnu.linkonce.t.*)
} >flash AT>flash :flash
. = ALIGN(4);
PROVIDE (_etext = .);
.rodata :
{
*(.rdata)
*(.rodata .rodata.*)
*(.gnu.linkonce.r.*)
} >flash AT>flash :flash
. = ALIGN(4);
.lalign :
{
. = ALIGN(4);
PROVIDE( _data_lma = . );
} >flash AT>flash :flash
.dalign :
{
. = ALIGN(4);
PROVIDE( _data = . );
} >ram AT>flash :ram_init
.data :
{
*(.data .data.*)
*(.gnu.linkonce.d.*)
} >ram AT>flash :ram_init
.srodata :
{
PROVIDE( _gp = . + 0x800 );
*(.srodata.cst16)
*(.srodata.cst8)
*(.srodata.cst4)
*(.srodata.cst2)
*(.srodata .srodata.*)
} >ram AT>flash :ram_init
.sdata :
{
*(.sdata .sdata.*)
*(.gnu.linkonce.s.*)
} >ram AT>flash :ram_init
. = ALIGN(4);
PROVIDE( _edata = . );
PROVIDE( _bss = . );
.bss :
{
*(.sbss*)
*(.gnu.linkonce.sb.*)
*(.bss .bss.*)
*(.gnu.linkonce.b.*)
*(COMMON)
. = ALIGN(4);
} >ram AT>ram :ram
. = ALIGN(8);
PROVIDE( _ebss = . );
PROVIDE( _end = . );
PROVIDE(_stack_top = __top_ram);
}

@ -0,0 +1,130 @@
/*
* Copyright (c) 2017, Alex Taradov <alex@taradov.com>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
OUTPUT_ARCH("riscv")
MEMORY
{
flash (rxai!w) : ORIGIN = 0x20000000, LENGTH = 16M
ram (wxa!ri) : ORIGIN = 0x80000000, LENGTH = 16K
}
PHDRS
{
flash PT_LOAD;
ram_init PT_LOAD;
ram PT_NULL;
}
ENTRY(_start)
__top_flash = ORIGIN(flash) + LENGTH(flash);
__top_ram = ORIGIN(ram) + LENGTH(ram);
SECTIONS
{
.text :
{
KEEP (*(.init._start))
KEEP (*(.init.reset_handler))
KEEP (*(SORT_NONE(.init)))
*(.text.unlikely .text.unlikely.*)
*(.text.startup .text.startup.*)
*(.text .text.*)
*(.gnu.linkonce.t.*)
} >flash AT>flash :flash
. = ALIGN(4);
PROVIDE (_etext = .);
.rodata :
{
*(.rdata)
*(.rodata .rodata.*)
*(.gnu.linkonce.r.*)
} >flash AT>flash :flash
. = ALIGN(4);
.lalign :
{
. = ALIGN(4);
PROVIDE( _data_lma = . );
} >flash AT>flash :flash
.dalign :
{
. = ALIGN(4);
PROVIDE( _data = . );
} >ram AT>flash :ram_init
.data :
{
*(.data .data.*)
*(.gnu.linkonce.d.*)
} >ram AT>flash :ram_init
.srodata :
{
PROVIDE( _gp = . + 0x800 );
*(.srodata.cst16)
*(.srodata.cst8)
*(.srodata.cst4)
*(.srodata.cst2)
*(.srodata .srodata.*)
} >ram AT>flash :ram_init
.sdata :
{
*(.sdata .sdata.*)
*(.gnu.linkonce.s.*)
} >ram AT>flash :ram_init
. = ALIGN(4);
PROVIDE( _edata = . );
PROVIDE( _bss = . );
.bss :
{
*(.sbss*)
*(.gnu.linkonce.sb.*)
*(.bss .bss.*)
*(.gnu.linkonce.b.*)
*(COMMON)
. = ALIGN(4);
} >ram AT>ram :ram
. = ALIGN(8);
PROVIDE( _ebss = . );
PROVIDE( _end = . );
PROVIDE(_stack_top = __top_ram);
}

@ -0,0 +1,161 @@
OUTPUT_ARCH( "riscv" )
ENTRY( _start )
MEMORY
{
flash (rxai!w) : ORIGIN = 0x20400000, LENGTH = 512M
ram (wxa!ri) : ORIGIN = 0x80000000, LENGTH = 16K
}
PHDRS
{
flash PT_LOAD;
ram_init PT_LOAD;
ram PT_NULL;
}
SECTIONS
{
__stack_size = DEFINED(__stack_size) ? __stack_size : 2K;
.init :
{
KEEP (*(SORT_NONE(.init)))
} >flash AT>flash :flash
.text :
{
*(.text.unlikely .text.unlikely.*)
*(.text.startup .text.startup.*)
*(.text .text.*)
*(.gnu.linkonce.t.*)
} >flash AT>flash :flash
.fini :
{
KEEP (*(SORT_NONE(.fini)))
} >flash AT>flash :flash
PROVIDE (__etext = .);
PROVIDE (_etext = .);
PROVIDE (etext = .);
.rodata :
{
*(.rdata)
*(.rodata .rodata.*)
*(.gnu.linkonce.r.*)
} >flash AT>flash :flash
. = ALIGN(4);
.preinit_array :
{
PROVIDE_HIDDEN (__preinit_array_start = .);
KEEP (*(.preinit_array))
PROVIDE_HIDDEN (__preinit_array_end = .);
} >flash AT>flash :flash
.init_array :
{
PROVIDE_HIDDEN (__init_array_start = .);
KEEP (*(SORT_BY_INIT_PRIORITY(.init_array.*) SORT_BY_INIT_PRIORITY(.ctors.*)))
KEEP (*(.init_array EXCLUDE_FILE (*crtbegin.o *crtbegin?.o *crtend.o *crtend?.o ) .ctors))
PROVIDE_HIDDEN (__init_array_end = .);
} >flash AT>flash :flash
.fini_array :
{
PROVIDE_HIDDEN (__fini_array_start = .);
KEEP (*(SORT_BY_INIT_PRIORITY(.fini_array.*) SORT_BY_INIT_PRIORITY(.dtors.*)))
KEEP (*(.fini_array EXCLUDE_FILE (*crtbegin.o *crtbegin?.o *crtend.o *crtend?.o ) .dtors))
PROVIDE_HIDDEN (__fini_array_end = .);
} >flash AT>flash :flash
.ctors :
{
/* gcc uses crtbegin.o to find the start of
the constructors, so we make sure it is
first. Because this is a wildcard, it
doesn't matter if the user does not
actually link against crtbegin.o; the
linker won't look for a file to match a
wildcard. The wildcard also means that it
doesn't matter which directory crtbegin.o
is in. */
KEEP (*crtbegin.o(.ctors))
KEEP (*crtbegin?.o(.ctors))
/* We don't want to include the .ctor section from
the crtend.o file until after the sorted ctors.
The .ctor section from the crtend file contains the
end of ctors marker and it must be last */
KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .ctors))
KEEP (*(SORT(.ctors.*)))
KEEP (*(.ctors))
} >flash AT>flash :flash
.dtors :
{
KEEP (*crtbegin.o(.dtors))
KEEP (*crtbegin?.o(.dtors))
KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .dtors))
KEEP (*(SORT(.dtors.*)))
KEEP (*(.dtors))
} >flash AT>flash :flash
.lalign :
{
. = ALIGN(4);
PROVIDE( _data_lma = . );
} >flash AT>flash :flash
.dalign :
{
. = ALIGN(4);
PROVIDE( _data = . );
} >ram AT>flash :ram_init
.data :
{
*(.data .data.*)
*(.gnu.linkonce.d.*)
. = ALIGN(8);
PROVIDE( __global_pointer$ = . + 0x800 );
*(.sdata .sdata.*)
*(.gnu.linkonce.s.*)
. = ALIGN(8);
*(.srodata.cst16)
*(.srodata.cst8)
*(.srodata.cst4)
*(.srodata.cst2)
*(.srodata .srodata.*)
} >ram AT>flash :ram_init
. = ALIGN(4);
PROVIDE( _edata = . );
PROVIDE( edata = . );
PROVIDE( _fbss = . );
PROVIDE( __bss_start = . );
.bss :
{
*(.sbss*)
*(.gnu.linkonce.sb.*)
*(.bss .bss.*)
*(.gnu.linkonce.b.*)
*(COMMON)
. = ALIGN(4);
} >ram AT>ram :ram
. = ALIGN(8);
PROVIDE( _end = . );
PROVIDE( end = . );
.stack ORIGIN(ram) + LENGTH(ram) - __stack_size :
{
PROVIDE( _heap_end = . );
. = __stack_size;
PROVIDE( _sp = . );
} >ram AT>ram :ram
}

@ -0,0 +1,161 @@
OUTPUT_ARCH( "riscv" )
ENTRY( _start )
MEMORY
{
flash (rxai!w) : ORIGIN = 0x20400000, LENGTH = 512M
ram (wxa!ri) : ORIGIN = 0x80000000, LENGTH = 16K
}
PHDRS
{
flash PT_LOAD;
ram_init PT_LOAD;
ram PT_NULL;
}
SECTIONS
{
__stack_size = DEFINED(__stack_size) ? __stack_size : 2K;
.init :
{
KEEP (*(SORT_NONE(.init)))
} >flash AT>flash :flash
.text :
{
*(.text.unlikely .text.unlikely.*)
*(.text.startup .text.startup.*)
*(.text .text.*)
*(.gnu.linkonce.t.*)
} >flash AT>flash :flash
.fini :
{
KEEP (*(SORT_NONE(.fini)))
} >flash AT>flash :flash
PROVIDE (__etext = .);
PROVIDE (_etext = .);
PROVIDE (etext = .);
.rodata :
{
*(.rdata)
*(.rodata .rodata.*)
*(.gnu.linkonce.r.*)
} >flash AT>flash :flash
. = ALIGN(4);
.preinit_array :
{
PROVIDE_HIDDEN (__preinit_array_start = .);
KEEP (*(.preinit_array))
PROVIDE_HIDDEN (__preinit_array_end = .);
} >flash AT>flash :flash
.init_array :
{
PROVIDE_HIDDEN (__init_array_start = .);
KEEP (*(SORT_BY_INIT_PRIORITY(.init_array.*) SORT_BY_INIT_PRIORITY(.ctors.*)))
KEEP (*(.init_array EXCLUDE_FILE (*crtbegin.o *crtbegin?.o *crtend.o *crtend?.o ) .ctors))
PROVIDE_HIDDEN (__init_array_end = .);
} >flash AT>flash :flash
.fini_array :
{
PROVIDE_HIDDEN (__fini_array_start = .);
KEEP (*(SORT_BY_INIT_PRIORITY(.fini_array.*) SORT_BY_INIT_PRIORITY(.dtors.*)))
KEEP (*(.fini_array EXCLUDE_FILE (*crtbegin.o *crtbegin?.o *crtend.o *crtend?.o ) .dtors))
PROVIDE_HIDDEN (__fini_array_end = .);
} >flash AT>flash :flash
.ctors :
{
/* gcc uses crtbegin.o to find the start of
the constructors, so we make sure it is
first. Because this is a wildcard, it
doesn't matter if the user does not
actually link against crtbegin.o; the
linker won't look for a file to match a
wildcard. The wildcard also means that it
doesn't matter which directory crtbegin.o
is in. */
KEEP (*crtbegin.o(.ctors))
KEEP (*crtbegin?.o(.ctors))
/* We don't want to include the .ctor section from
the crtend.o file until after the sorted ctors.
The .ctor section from the crtend file contains the
end of ctors marker and it must be last */
KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .ctors))
KEEP (*(SORT(.ctors.*)))
KEEP (*(.ctors))
} >flash AT>flash :flash
.dtors :
{
KEEP (*crtbegin.o(.dtors))
KEEP (*crtbegin?.o(.dtors))
KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .dtors))
KEEP (*(SORT(.dtors.*)))
KEEP (*(.dtors))
} >flash AT>flash :flash
.lalign :
{
. = ALIGN(4);
PROVIDE( _data_lma = . );
} >flash AT>flash :flash
.dalign :
{
. = ALIGN(4);
PROVIDE( _data = . );
} >ram AT>flash :ram_init
.data :
{
*(.data .data.*)
*(.gnu.linkonce.d.*)
. = ALIGN(8);
PROVIDE( __global_pointer$ = . + 0x800 );
*(.sdata .sdata.*)
*(.gnu.linkonce.s.*)
. = ALIGN(8);
*(.srodata.cst16)
*(.srodata.cst8)
*(.srodata.cst4)
*(.srodata.cst2)
*(.srodata .srodata.*)
} >ram AT>flash :ram_init
. = ALIGN(4);
PROVIDE( _edata = . );
PROVIDE( edata = . );
PROVIDE( _fbss = . );
PROVIDE( __bss_start = . );
.bss :
{
*(.sbss*)
*(.gnu.linkonce.sb.*)
*(.bss .bss.*)
*(.gnu.linkonce.b.*)
*(COMMON)
. = ALIGN(4);
} >ram AT>ram :ram
. = ALIGN(8);
PROVIDE( _end = . );
PROVIDE( end = . );
.stack ORIGIN(ram) + LENGTH(ram) - __stack_size :
{
PROVIDE( _heap_end = . );
. = __stack_size;
PROVIDE( _sp = . );
} >ram AT>ram :ram
}

@ -0,0 +1,11 @@
[esf.links]
common = "arch/riscv/common"
mcu = "arch/riscv/FE310/FE310_G/mcu/"
ld = "arch/riscv/FE310/FE310_G/ld/"
cfg = "arch/riscv/FE310/FE310_G/manifest/"
[esf.includes]
IGLOO_INCLUDES = ["platform.h", "encoding.h"]
[esf.openocd]
scripts = "arch/riscv/FE310/FE310_G/scripts/"

File diff suppressed because it is too large Load Diff

@ -0,0 +1,133 @@
// See LICENSE for license details.
#ifndef _SIFIVE_PLATFORM_H
#define _SIFIVE_PLATFORM_H
// Some things missing from the official encoding.h
#define MCAUSE_INT 0x80000000
#define MCAUSE_CAUSE 0x7FFFFFFF
#include "sifive/const.h"
#include "sifive/devices/aon.h"
#include "sifive/devices/clint.h"
#include "sifive/devices/gpio.h"
#include "sifive/devices/otp.h"
#include "sifive/devices/plic.h"
#include "sifive/devices/prci.h"
#include "sifive/devices/pwm.h"
#include "sifive/devices/spi.h"
#include "sifive/devices/uart.h"
/****************************************************************************
* Platform definitions
*****************************************************************************/
// Memory map
#define MASKROM_BASE_ADDR _AC(0x00001000,UL)
#define TRAPVEC_TABLE_BASE_ADDR _AC(0x00001010,UL)
#define OTP_MMAP_ADDR _AC(0x00020000,UL)
#define CLINT_BASE_ADDR _AC(0x02000000,UL)
#define PLIC_BASE_ADDR _AC(0x0C000000,UL)
#define AON_BASE_ADDR _AC(0x10000000,UL)
#define PRCI_BASE_ADDR _AC(0x10008000,UL)
#define OTP_BASE_ADDR _AC(0x10010000,UL)
#define GPIO_BASE_ADDR _AC(0x10012000,UL)
#define UART0_BASE_ADDR _AC(0x10013000,UL)
#define SPI0_BASE_ADDR _AC(0x10014000,UL)
#define PWM0_BASE_ADDR _AC(0x10015000,UL)
#define UART1_BASE_ADDR _AC(0x10023000,UL)
#define SPI1_BASE_ADDR _AC(0x10024000,UL)
#define PWM1_BASE_ADDR _AC(0x10025000,UL)
#define SPI2_BASE_ADDR _AC(0x10034000,UL)
#define PWM2_BASE_ADDR _AC(0x10035000,UL)
#define SPI0_MMAP_ADDR _AC(0x20000000,UL)
#define MEM_BASE_ADDR _AC(0x80000000,UL)
// IOF masks
#define IOF0_SPI1_MASK _AC(0x000007FC,UL)
#define SPI11_NUM_SS (4)
#define IOF_SPI1_SS0 (2u)
#define IOF_SPI1_SS1 (8u)
#define IOF_SPI1_SS2 (9u)
#define IOF_SPI1_SS3 (10u)
#define IOF_SPI1_MOSI (3u)
#define IOF_SPI1_MISO (4u)
#define IOF_SPI1_SCK (5u)
#define IOF_SPI1_DQ0 (3u)
#define IOF_SPI1_DQ1 (4u)
#define IOF_SPI1_DQ2 (6u)
#define IOF_SPI1_DQ3 (7u)
#define IOF0_SPI2_MASK _AC(0xFC000000,UL)
#define SPI2_NUM_SS (1)
#define IOF_SPI2_SS0 (26u)
#define IOF_SPI2_MOSI (27u)
#define IOF_SPI2_MISO (28u)
#define IOF_SPI2_SCK (29u)
#define IOF_SPI2_DQ0 (27u)
#define IOF_SPI2_DQ1 (28u)
#define IOF_SPI2_DQ2 (30u)
#define IOF_SPI2_DQ3 (31u)
//#define IOF0_I2C_MASK _AC(0x00003000,UL)
#define IOF0_UART0_MASK _AC(0x00030000, UL)
#define IOF_UART0_RX (16u)
#define IOF_UART0_TX (17u)
#define IOF0_UART1_MASK _AC(0x03000000, UL)
#define IOF_UART1_RX (24u)
#define IOF_UART1_TX (25u)
#define IOF1_PWM0_MASK _AC(0x0000000F, UL)
#define IOF1_PWM1_MASK _AC(0x00780000, UL)
#define IOF1_PWM2_MASK _AC(0x00003C00, UL)
// Interrupt numbers
#define INT_RESERVED 0
#define INT_WDOGCMP 1
#define INT_RTCCMP 2
#define INT_UART0_BASE 3
#define INT_UART1_BASE 4
#define INT_SPI0_BASE 5
#define INT_SPI1_BASE 6
#define INT_SPI2_BASE 7
#define INT_GPIO_BASE 8
#define INT_PWM0_BASE 40
#define INT_PWM1_BASE 44
#define INT_PWM2_BASE 48
// Helper functions
#define _REG32(p, i) (*(volatile uint32_t *) ((p) + (i)))
#define _REG32P(p, i) ((volatile uint32_t *) ((p) + (i)))
#define AON_REG(offset) _REG32(AON_BASE_ADDR, offset)
#define CLINT_REG(offset) _REG32(CLINT_BASE_ADDR, offset)
#define GPIO_REG(offset) _REG32(GPIO_BASE_ADDR, offset)
#define OTP_REG(offset) _REG32(OTP_BASE_ADDR, offset)
#define PLIC_REG(offset) _REG32(PLIC_BASE_ADDR, offset)
#define PRCI_REG(offset) _REG32(PRCI_BASE_ADDR, offset)
#define PWM0_REG(offset) _REG32(PWM0_BASE_ADDR, offset)
#define PWM1_REG(offset) _REG32(PWM1_BASE_ADDR, offset)
#define PWM2_REG(offset) _REG32(PWM2_BASE_ADDR, offset)
#define SPI0_REG(offset) _REG32(SPI0_BASE_ADDR, offset)
#define SPI1_REG(offset) _REG32(SPI1_BASE_ADDR, offset)
#define SPI2_REG(offset) _REG32(SPI2_BASE_ADDR, offset)
#define UART0_REG(offset) _REG32(UART0_BASE_ADDR, offset)
#define UART1_REG(offset) _REG32(UART1_BASE_ADDR, offset)
// Misc
#include <stdint.h>
#define NUM_GPIO 32
#define PLIC_NUM_INTERRUPTS 52
#define PLIC_NUM_PRIORITIES 7
//#include "hifive1.h"
unsigned long get_cpu_freq(void);
unsigned long get_timer_freq(void);
uint64_t get_timer_value(void);
#endif /* _SIFIVE_PLATFORM_H */

@ -0,0 +1,35 @@
#ifndef _RISCV_BITS_H
#define _RISCV_BITS_H
#define likely(x) __builtin_expect((x), 1)
#define unlikely(x) __builtin_expect((x), 0)
#define ROUNDUP(a, b) ((((a)-1)/(b)+1)*(b))
#define ROUNDDOWN(a, b) ((a)/(b)*(b))
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define CLAMP(a, lo, hi) MIN(MAX(a, lo), hi)
#define EXTRACT_FIELD(val, which) (((val) & (which)) / ((which) & ~((which)-1)))
#define INSERT_FIELD(val, which, fieldval) (((val) & ~(which)) | ((fieldval) * ((which) & ~((which)-1))))
#define STR(x) XSTR(x)
#define XSTR(x) #x
#ifdef __riscv64
# define SLL32 sllw
# define STORE sd
# define LOAD ld
# define LWU lwu
# define LOG_REGBYTES 3
#else
# define SLL32 sll
# define STORE sw
# define LOAD lw
# define LWU lw
# define LOG_REGBYTES 2
#endif
#define REGBYTES (1 << LOG_REGBYTES)
#endif

@ -0,0 +1,17 @@
/* Derived from <linux/const.h> */
#ifndef _SIFIVE_CONST_H
#define _SIFIVE_CONST_H
#ifdef __ASSEMBLER__
#define _AC(X,Y) X
#define _AT(T,X) X
#else
#define _AC(X,Y) (X##Y)
#define _AT(T,X) ((T)(X))
#endif /* !__ASSEMBLER__*/
#define _BITUL(x) (_AC(1,UL) << (x))
#define _BITULL(x) (_AC(1,ULL) << (x))
#endif /* _SIFIVE_CONST_H */

@ -0,0 +1,88 @@
// See LICENSE for license details.
#ifndef _SIFIVE_AON_H
#define _SIFIVE_AON_H
/* Register offsets */
#define AON_WDOGCFG 0x000
#define AON_WDOGCOUNT 0x008
#define AON_WDOGS 0x010
#define AON_WDOGFEED 0x018
#define AON_WDOGKEY 0x01C
#define AON_WDOGCMP 0x020
#define AON_RTCCFG 0x040
#define AON_RTCLO 0x048
#define AON_RTCHI 0x04C
#define AON_RTCS 0x050
#define AON_RTCCMP 0x060
#define AON_BACKUP0 0x080
#define AON_BACKUP1 0x084
#define AON_BACKUP2 0x088
#define AON_BACKUP3 0x08C
#define AON_BACKUP4 0x090
#define AON_BACKUP5 0x094
#define AON_BACKUP6 0x098
#define AON_BACKUP7 0x09C
#define AON_BACKUP8 0x0A0
#define AON_BACKUP9 0x0A4
#define AON_BACKUP10 0x0A8
#define AON_BACKUP11 0x0AC
#define AON_BACKUP12 0x0B0
#define AON_BACKUP13 0x0B4
#define AON_BACKUP14 0x0B8
#define AON_BACKUP15 0x0BC
#define AON_PMUWAKEUPI0 0x100
#define AON_PMUWAKEUPI1 0x104
#define AON_PMUWAKEUPI2 0x108
#define AON_PMUWAKEUPI3 0x10C
#define AON_PMUWAKEUPI4 0x110
#define AON_PMUWAKEUPI5 0x114
#define AON_PMUWAKEUPI6 0x118
#define AON_PMUWAKEUPI7 0x11C
#define AON_PMUSLEEPI0 0x120
#define AON_PMUSLEEPI1 0x124
#define AON_PMUSLEEPI2 0x128
#define AON_PMUSLEEPI3 0x12C
#define AON_PMUSLEEPI4 0x130
#define AON_PMUSLEEPI5 0x134
#define AON_PMUSLEEPI6 0x138
#define AON_PMUSLEEPI7 0x13C
#define AON_PMUIE 0x140
#define AON_PMUCAUSE 0x144
#define AON_PMUSLEEP 0x148
#define AON_PMUKEY 0x14C
#define AON_LFROSC 0x070
/* Constants */
#define AON_WDOGKEY_VALUE 0x51F15E
#define AON_WDOGFEED_VALUE 0xD09F00D
#define AON_WDOGCFG_SCALE 0x0000000F
#define AON_WDOGCFG_RSTEN 0x00000100
#define AON_WDOGCFG_ZEROCMP 0x00000200
#define AON_WDOGCFG_ENALWAYS 0x00001000
#define AON_WDOGCFG_ENCOREAWAKE 0x00002000
#define AON_WDOGCFG_CMPIP 0x10000000
#define AON_RTCCFG_SCALE 0x0000000F
#define AON_RTCCFG_ENALWAYS 0x00001000
#define AON_RTCCFG_CMPIP 0x10000000
#define AON_WAKEUPCAUSE_RESET 0x00
#define AON_WAKEUPCAUSE_RTC 0x01
#define AON_WAKEUPCAUSE_DWAKEUP 0x02
#define AON_WAKEUPCAUSE_AWAKEUP 0x03
#define AON_RESETCAUSE_POWERON 0x0000
#define AON_RESETCAUSE_EXTERNAL 0x0100
#define AON_RESETCAUSE_WATCHDOG 0x0200
#define AON_PMUCAUSE_WAKEUPCAUSE 0x00FF
#define AON_PMUCAUSE_RESETCAUSE 0xFF00
#endif /* _SIFIVE_AON_H */

@ -0,0 +1,14 @@
// See LICENSE for license details
#ifndef _SIFIVE_CLINT_H
#define _SIFIVE_CLINT_H
#define CLINT_MSIP 0x0000
#define CLINT_MSIP_size 0x4
#define CLINT_MTIMECMP 0x4000
#define CLINT_MTIMECMP_size 0x8
#define CLINT_MTIME 0xBFF8
#define CLINT_MTIME_size 0x8
#endif /* _SIFIVE_CLINT_H */

@ -0,0 +1,24 @@
// See LICENSE for license details.
#ifndef _SIFIVE_GPIO_H
#define _SIFIVE_GPIO_H
#define GPIO_INPUT_VAL (0x00)
#define GPIO_INPUT_EN (0x04)
#define GPIO_OUTPUT_EN (0x08)
#define GPIO_OUTPUT_VAL (0x0C)
#define GPIO_PULLUP_EN (0x10)
#define GPIO_DRIVE (0x14)
#define GPIO_RISE_IE (0x18)
#define GPIO_RISE_IP (0x1C)
#define GPIO_FALL_IE (0x20)
#define GPIO_FALL_IP (0x24)
#define GPIO_HIGH_IE (0x28)
#define GPIO_HIGH_IP (0x2C)
#define GPIO_LOW_IE (0x30)
#define GPIO_LOW_IP (0x34)
#define GPIO_IOF_EN (0x38)
#define GPIO_IOF_SEL (0x3C)
#define GPIO_OUTPUT_XOR (0x40)
#endif /* _SIFIVE_GPIO_H */

@ -0,0 +1,23 @@
// See LICENSE for license details.
#ifndef _SIFIVE_OTP_H
#define _SIFIVE_OTP_H
/* Register offsets */
#define OTP_LOCK 0x00
#define OTP_CK 0x04
#define OTP_OE 0x08
#define OTP_SEL 0x0C
#define OTP_WE 0x10
#define OTP_MR 0x14
#define OTP_MRR 0x18
#define OTP_MPP 0x1C
#define OTP_VRREN 0x20
#define OTP_VPPEN 0x24
#define OTP_A 0x28
#define OTP_D 0x2C
#define OTP_Q 0x30
#define OTP_READ_TIMINGS 0x34
#endif

@ -0,0 +1,31 @@
// See LICENSE for license details.
#ifndef PLIC_H
#define PLIC_H
#include <sifive/const.h>
// 32 bits per source
#define PLIC_PRIORITY_OFFSET _AC(0x0000,UL)
#define PLIC_PRIORITY_SHIFT_PER_SOURCE 2
// 1 bit per source (1 address)
#define PLIC_PENDING_OFFSET _AC(0x1000,UL)
#define PLIC_PENDING_SHIFT_PER_SOURCE 0
//0x80 per target
#define PLIC_ENABLE_OFFSET _AC(0x2000,UL)
#define PLIC_ENABLE_SHIFT_PER_TARGET 7
#define PLIC_THRESHOLD_OFFSET _AC(0x200000,UL)
#define PLIC_CLAIM_OFFSET _AC(0x200004,UL)
#define PLIC_THRESHOLD_SHIFT_PER_TARGET 12
#define PLIC_CLAIM_SHIFT_PER_TARGET 12
#define PLIC_MAX_SOURCE 1023
#define PLIC_SOURCE_MASK 0x3FF
#define PLIC_MAX_TARGET 15871
#define PLIC_TARGET_MASK 0x3FFF
#endif /* PLIC_H */

@ -0,0 +1,56 @@
// See LICENSE for license details.
#ifndef _SIFIVE_PRCI_H
#define _SIFIVE_PRCI_H
/* Register offsets */
#define PRCI_HFROSCCFG (0x0000)
#define PRCI_HFXOSCCFG (0x0004)
#define PRCI_PLLCFG (0x0008)
#define PRCI_PLLDIV (0x000C)
#define PRCI_PROCMONCFG (0x00F0)
/* Fields */
#define ROSC_DIV(x) (((x) & 0x2F) << 0 )
#define ROSC_TRIM(x) (((x) & 0x1F) << 16)
#define ROSC_EN(x) (((x) & 0x1 ) << 30)
#define ROSC_RDY(x) (((x) & 0x1 ) << 31)
#define XOSC_EN(x) (((x) & 0x1) << 30)
#define XOSC_RDY(x) (((x) & 0x1) << 31)
#define PLL_R(x) (((x) & 0x7) << 0)
// single reserved bit for F LSB.
#define PLL_F(x) (((x) & 0x3F) << 4)
#define PLL_Q(x) (((x) & 0x3) << 10)
#define PLL_SEL(x) (((x) & 0x1) << 16)
#define PLL_REFSEL(x) (((x) & 0x1) << 17)
#define PLL_BYPASS(x) (((x) & 0x1) << 18)
#define PLL_LOCK(x) (((x) & 0x1) << 31)
#define PLL_R_default 0x1
#define PLL_F_default 0x1F
#define PLL_Q_default 0x3
#define PLL_REFSEL_HFROSC 0x0
#define PLL_REFSEL_HFXOSC 0x1
#define PLL_SEL_HFROSC 0x0
#define PLL_SEL_PLL 0x1
#define PLL_FINAL_DIV(x) (((x) & 0x3F) << 0)
#define PLL_FINAL_DIV_BY_1(x) (((x) & 0x1 ) << 8)
#define PROCMON_DIV(x) (((x) & 0x1F) << 0)
#define PROCMON_TRIM(x) (((x) & 0x1F) << 8)
#define PROCMON_EN(x) (((x) & 0x1) << 16)
#define PROCMON_SEL(x) (((x) & 0x3) << 24)
#define PROCMON_NT_EN(x) (((x) & 0x1) << 28)
#define PROCMON_SEL_HFCLK 0
#define PROCMON_SEL_HFXOSCIN 1
#define PROCMON_SEL_PLLOUTDIV 2
#define PROCMON_SEL_PROCMON 3
#endif // _SIFIVE_PRCI_H

@ -0,0 +1,37 @@
// See LICENSE for license details.
#ifndef _SIFIVE_PWM_H
#define _SIFIVE_PWM_H
/* Register offsets */
#define PWM_CFG 0x00
#define PWM_COUNT 0x08
#define PWM_S 0x10
#define PWM_CMP0 0x20
#define PWM_CMP1 0x24
#define PWM_CMP2 0x28
#define PWM_CMP3 0x2C
/* Constants */
#define PWM_CFG_SCALE 0x0000000F
#define PWM_CFG_STICKY 0x00000100
#define PWM_CFG_ZEROCMP 0x00000200
#define PWM_CFG_DEGLITCH 0x00000400
#define PWM_CFG_ENALWAYS 0x00001000
#define PWM_CFG_ONESHOT 0x00002000
#define PWM_CFG_CMP0CENTER 0x00010000
#define PWM_CFG_CMP1CENTER 0x00020000
#define PWM_CFG_CMP2CENTER 0x00040000
#define PWM_CFG_CMP3CENTER 0x00080000
#define PWM_CFG_CMP0GANG 0x01000000
#define PWM_CFG_CMP1GANG 0x02000000
#define PWM_CFG_CMP2GANG 0x04000000
#define PWM_CFG_CMP3GANG 0x08000000
#define PWM_CFG_CMP0IP 0x10000000
#define PWM_CFG_CMP1IP 0x20000000
#define PWM_CFG_CMP2IP 0x40000000
#define PWM_CFG_CMP3IP 0x80000000
#endif /* _SIFIVE_PWM_H */

@ -0,0 +1,80 @@
// See LICENSE for license details.
#ifndef _SIFIVE_SPI_H
#define _SIFIVE_SPI_H
/* Register offsets */
#define SPI_REG_SCKDIV 0x00
#define SPI_REG_SCKMODE 0x04
#define SPI_REG_CSID 0x10
#define SPI_REG_CSDEF 0x14
#define SPI_REG_CSMODE 0x18
#define SPI_REG_DCSSCK 0x28
#define SPI_REG_DSCKCS 0x2a
#define SPI_REG_DINTERCS 0x2c
#define SPI_REG_DINTERXFR 0x2e
#define SPI_REG_FMT 0x40
#define SPI_REG_TXFIFO 0x48
#define SPI_REG_RXFIFO 0x4c
#define SPI_REG_TXCTRL 0x50
#define SPI_REG_RXCTRL 0x54
#define SPI_REG_FCTRL 0x60
#define SPI_REG_FFMT 0x64
#define SPI_REG_IE 0x70
#define SPI_REG_IP 0x74
/* Fields */
#define SPI_SCK_POL 0x1
#define SPI_SCK_PHA 0x2
#define SPI_FMT_PROTO(x) ((x) & 0x3)
#define SPI_FMT_ENDIAN(x) (((x) & 0x1) << 2)
#define SPI_FMT_DIR(x) (((x) & 0x1) << 3)
#define SPI_FMT_LEN(x) (((x) & 0xf) << 16)
/* TXCTRL register */
#define SPI_TXWM(x) ((x) & 0xffff)
/* RXCTRL register */
#define SPI_RXWM(x) ((x) & 0xffff)
#define SPI_IP_TXWM 0x1
#define SPI_IP_RXWM 0x2
#define SPI_FCTRL_EN 0x1
#define SPI_INSN_CMD_EN 0x1
#define SPI_INSN_ADDR_LEN(x) (((x) & 0x7) << 1)
#define SPI_INSN_PAD_CNT(x) (((x) & 0xf) << 4)
#define SPI_INSN_CMD_PROTO(x) (((x) & 0x3) << 8)
#define SPI_INSN_ADDR_PROTO(x) (((x) & 0x3) << 10)
#define SPI_INSN_DATA_PROTO(x) (((x) & 0x3) << 12)
#define SPI_INSN_CMD_CODE(x) (((x) & 0xff) << 16)
#define SPI_INSN_PAD_CODE(x) (((x) & 0xff) << 24)
#define SPI_TXFIFO_FULL (1 << 31)
#define SPI_RXFIFO_EMPTY (1 << 31)
/* Values */
#define SPI_CSMODE_AUTO 0
#define SPI_CSMODE_HOLD 2
#define SPI_CSMODE_OFF 3
#define SPI_DIR_RX 0
#define SPI_DIR_TX 1
#define SPI_PROTO_S 0
#define SPI_PROTO_D 1
#define SPI_PROTO_Q 2
#define SPI_ENDIAN_MSB 0
#define SPI_ENDIAN_LSB 1
#endif /* _SIFIVE_SPI_H */

@ -0,0 +1,27 @@
// See LICENSE for license details.
#ifndef _SIFIVE_UART_H
#define _SIFIVE_UART_H
/* Register offsets */
#define UART_REG_TXFIFO 0x00
#define UART_REG_RXFIFO 0x04
#define UART_REG_TXCTRL 0x08
#define UART_REG_RXCTRL 0x0c
#define UART_REG_IE 0x10
#define UART_REG_IP 0x14
#define UART_REG_DIV 0x18
/* TXCTRL register */
#define UART_TXEN 0x1
#define UART_TXWM(x) (((x) & 0xffff) << 16)
/* RXCTRL register */
#define UART_RXEN 0x1
#define UART_RXWM(x) (((x) & 0xffff) << 16)
/* IP register */
#define UART_IP_TXWM 0x1
#define UART_IP_RXWM 0x2
#endif /* _SIFIVE_UART_H */

@ -0,0 +1,16 @@
#ifndef _SECTIONS_H
#define _SECTIONS_H
extern unsigned char _rom[];
extern unsigned char _rom_end[];
extern unsigned char _ram[];
extern unsigned char _ram_end[];
extern unsigned char _ftext[];
extern unsigned char _etext[];
extern unsigned char _fbss[];
extern unsigned char _ebss[];
extern unsigned char _end[];
#endif /* _SECTIONS_H */

@ -0,0 +1,202 @@
/*
* Copyright (c) 2017, Alex Taradov <alex@taradov.com>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
//-----------------------------------------------------------------------------
#include "encoding.h"
#include "platform.h"
//-----------------------------------------------------------------------------
#define DUMMY __attribute__ ((weak, alias ("irq_handler_dummy")))
//-----------------------------------------------------------------------------
void irq_handler_dummy(void);
DUMMY void irq_handler_m_soft(void);
DUMMY void irq_handler_m_timer(void);
DUMMY void irq_handler_m_ext(void);
extern unsigned int _data_lma;
extern unsigned int _data;
extern unsigned int _edata;
extern unsigned int _bss;
extern unsigned int _ebss;
extern int main(void);
void trap_entry(void);
//-----------------------------------------------------------------------------
asm (" \
.section .init._start \n \
.globl _start \n \
_start: \n \
la gp, _gp \n \
la sp, _stack_top \n \
");
//-----------------------------------------------------------------------------
__attribute__ ((used, section(".init.reset_handler")))
static void reset_handler(void)
{
unsigned int *src, *dst;
write_csr(mtvec, &trap_entry);
src = &_data_lma;
dst = &_data;
while (dst < &_edata)
*dst++ = *src++;
dst = &_bss;
while (dst < &_ebss)
*dst++ = 0;
//__libc_init_array();
/*
#ifndef __riscv_float_abi_soft
// Enable FPU
li t0, MSTATUS_FS
csrs mstatus, t0
csrr t1, mstatus
and t1, t1, t0
beqz t1, 1f
fssr x0
1:
#endif
*/
main();
while (1);
}
//-----------------------------------------------------------------------------
asm (" \
.section .text.trap_entry \n \
.align 4 \n \
trap_entry: \n \
addi sp, sp, -32*4 \n \
sw x1, 0x04(sp) \n \
sw x2, 0x08(sp) \n \
sw x3, 0x0c(sp) \n \
sw x4, 0x10(sp) \n \
sw x5, 0x14(sp) \n \
sw x6, 0x18(sp) \n \
sw x7, 0x1c(sp) \n \
sw x8, 0x20(sp) \n \
sw x9, 0x24(sp) \n \
sw x10, 0x28(sp) \n \
sw x11, 0x2c(sp) \n \
sw x12, 0x30(sp) \n \
sw x13, 0x34(sp) \n \
sw x14, 0x38(sp) \n \
sw x15, 0x3c(sp) \n \
sw x16, 0x40(sp) \n \
sw x17, 0x44(sp) \n \
sw x18, 0x48(sp) \n \
sw x19, 0x4c(sp) \n \
sw x20, 0x50(sp) \n \
sw x21, 0x54(sp) \n \
sw x22, 0x58(sp) \n \
sw x23, 0x5c(sp) \n \
sw x24, 0x60(sp) \n \
sw x25, 0x64(sp) \n \
sw x26, 0x68(sp) \n \
sw x27, 0x6c(sp) \n \
sw x28, 0x70(sp) \n \
sw x29, 0x74(sp) \n \
sw x30, 0x78(sp) \n \
sw x31, 0x7c(sp) \n \
\n \
csrr a0, mcause \n \
csrr a1, mepc \n \
mv a2, sp \n \
jal trap_handler \n \
csrw mepc, a0 \n \
\n \
li t0, 0x00001800 \n \
csrs mstatus, t0 \n \
\n \
lw x1, 0x04(sp) \n \
lw x2, 0x08(sp) \n \
lw x3, 0x0c(sp) \n \
lw x4, 0x10(sp) \n \
lw x5, 0x14(sp) \n \
lw x6, 0x18(sp) \n \
lw x7, 0x1c(sp) \n \
lw x8, 0x20(sp) \n \
lw x9, 0x24(sp) \n \
lw x10, 0x28(sp) \n \
lw x11, 0x2c(sp) \n \
lw x12, 0x30(sp) \n \
lw x13, 0x34(sp) \n \
lw x14, 0x38(sp) \n \
lw x15, 0x3c(sp) \n \
lw x16, 0x40(sp) \n \
lw x17, 0x44(sp) \n \
lw x18, 0x48(sp) \n \
lw x19, 0x4c(sp) \n \
lw x20, 0x50(sp) \n \
lw x21, 0x54(sp) \n \
lw x22, 0x58(sp) \n \
lw x23, 0x5c(sp) \n \
lw x24, 0x60(sp) \n \
lw x25, 0x64(sp) \n \
lw x26, 0x68(sp) \n \
lw x27, 0x6c(sp) \n \
lw x28, 0x70(sp) \n \
lw x29, 0x74(sp) \n \
lw x30, 0x78(sp) \n \
lw x31, 0x7c(sp) \n \
addi sp, sp, 32*4 \n \
mret \n \
");
//-----------------------------------------------------------------------------
unsigned int trap_handler(uintptr_t mcause, unsigned int epc)
{
if (mcause & MCAUSE_INT)
{
int cause = mcause & MCAUSE_CAUSE;
if (IRQ_M_SOFT == cause)
irq_handler_m_soft();
else if (IRQ_M_EXT == cause)
irq_handler_m_ext();
else if (IRQ_M_TIMER == cause)
irq_handler_m_timer();
else
irq_handler_dummy();
}
return epc;
}
//-----------------------------------------------------------------------------
void irq_handler_dummy(void)
{
while (1);
}

@ -0,0 +1,18 @@
source [find interface/jlink.cfg]
transport select jtag
adapter speed 4000
set _CHIPNAME fe310g000
jtag newtap $_CHIPNAME cpu -irlen 5 -expected-id 0x10e31913
set _TARGETNAME $_CHIPNAME.cpu
target create $_TARGETNAME riscv -chain-position $_TARGETNAME
$_TARGETNAME configure -work-area-phys 0x80000000 -work-area-size 10000 -work-area-backup 1
flash bank onboard_spi_flash fespi 0x20000000 0 0 0 $_TARGETNAME
init
jlink jtag 3
halt
flash protect 0 64 last off

@ -0,0 +1,18 @@
source [find interface/jlink.cfg]
transport select jtag
adapter speed 4000
set _CHIPNAME fe310g002
jtag newtap $_CHIPNAME cpu -irlen 5 -expected-id 0x20000913
set _TARGETNAME $_CHIPNAME.cpu
target create $_TARGETNAME.0 riscv -chain-position $_TARGETNAME
$_TARGETNAME.0 configure -work-area-phys 0x80000000 -work-area-size 0x4000 -work-area-backup 0
flash bank onboard_spi_flash fespi 0x20000000 0 0 0 $_TARGETNAME.0
init
jlink jtag 3
halt
flash protect 0 1 last off

@ -4,22 +4,37 @@
[arch]
PROJECT_NAME = ""
CC = "${TOOLCHAIN}-gcc"
CXX = "${TOOLCHAIN}-g++"
OBJCOPY = "${TOOLCHAIN}-objcopy"
OBJDUMP = "${TOOLCHAIN}-objdump"
GDB = "${TOOLCHAIN}-gdb-py"
SIZE = "${TOOLCHAIN}-size"
AS = "${TOOLCHAIN}-as"
DIR_INCLUDES = ["-I$(QUOTE)../../../ESF/mcu/inc$(QUOTE)",
"-I$(QUOTE)../../../inc$(QUOTE)"]
DEPS = "$(OBJS:%.o=%.d)"
DEPS_AS_ARGS = "$(OBJS:%.o=%.d)"
DEPS_AS_ARGS = "$(OBJS_AS_ARGS:%.o=%.d)"
OBJS = ["src/main.o"]
OBJS_AS_ARGS = ["$(QUOTE)src/main.o$(QUOTE)"]
CLEAN_PREREQS = [""]
CLEAN_CMDS = ["rm -f $(OBJS_AS_ARGS)",
"rm -f $(DEPS_AS_ARGS)",
"rm -f $(PROJECT_NAME).bin",
"rm -f $(PROJECT_NAME).elf",
"rm -f $(PROJECT_NAME).hex"]
CLEAN_CMDS = ["@rm -f $(OBJS_AS_ARGS)",
"@rm -f $(DEPS_AS_ARGS)",
"@rm -f $(PROJECT_NAME).bin",
"@rm -f $(PROJECT_NAME).elf",
"@rm -f $(PROJECT_NAME).hex"]
SUB_DIRS = ["src", "ESF/mcu/src"]
DEBUG_PREREQS = ["all"]
DEBUG_CMDS = ["@$(GDB) $(PROJECT_NAME).elf -x $(QUOTE)scripts/debug.gdb$(QUOTE)"]
DEBUG_PREREQS = ["$(PROJECT_NAME).elf"]
DEBUG_CMDS = ["$(QUOTE)arm-none-eabi-gdb$(QUOTE) -iex $(QUOTE)target extended-remote localhost:3333$(QUOTE) $(PROJECT_NAME).elf"]
PUSH_PREREQS = ["all"]
PUSH_CMDS = ["@echo $(QUOTE)$(QUOTE)",
"@echo $(QUOTE)Uploading $(PROJECT_NAME).elf...$(QUOTE)",
"@$(GDB) $(PROJECT_NAME).elf -x $(QUOTE)scripts/push.gdb$(QUOTE) >/dev/null",
"@echo $(QUOTE)$(QUOTE)$(PROJECT_NAME).elf $(QUOTE) uploaded!$(QUOTE)",
"@$(QUOTE)$(SIZE)$(QUOTE) $(QUOTE)$(PROJECT_NAME).elf$(QUOTE)"]
ELF_TARGET_PREREQS = ["$(OBJS)"]
ELF_TARGET_CMDS = ["$(QUOTE)$(CC)$(QUOTE) -o $@ $(OBJS_AS_ARGS) $(ELF_FLAGS)"]
@ -32,13 +47,6 @@ HEX_TARGET_CMDS = ["$(QUOTE)$(OBJCOPY)$(QUOTE) -O ihex $(HEX_FLAGS) $(QUOTE)$<$(
[arch.arm]
TOOLCHAIN = "${ESF_DIR}/toolchains/arm/bin/arm-none-eabi"
CC = "${TOOLCHAIN}-gcc"
CXX = "${TOOLCHAIN}-g++"
OBJCOPY = "${TOOLCHAIN}-objcopy"
OBJDUMP = "${TOOLCHAIN}-objdump"
GDB = "${TOOLCHAIN}-gdb"
SIZE = "${TOOLCHAIN}-size"
AS = "${TOOLCHAIN}-as"
CFLAGS = ["-x c", "-DDEBUG", "-Os",
"-g3",
"-Wall",
@ -76,20 +84,17 @@ ALL_PREREQS = ["$(SUB_DIRS)",
"$(PROJECT_NAME).eep",
"$(PROJECT_NAME).lss"]
ALL_CMDS = ["$(QUOTE)$(SIZE)$(QUOTE) $(QUOTE)$(PROJECT_NAME).elf$(QUOTE)"]
SUB_DIRS = ["src", "ESF/mcu/src"]
EEP_TARGET_PREREQS = ["$(PROJECT_NAME).elf"]
EEP_TARGET_CMDS = ["$(QUOTE)$(OBJCOPY)$(QUOTE) $(EEP_FLAGS) -O binary $(QUOTE)$<$(QUOTE)",
"$(QUOTE)$@$(QUOTE) || exit 0"]
EEP_TARGET_CMDS = ["$(QUOTE)$(OBJCOPY)$(QUOTE) $(EEP_FLAGS) -O binary $(QUOTE)$<$(QUOTE) $(QUOTE)$@$(QUOTE) || exit 0"]
LSS_TARGET_PREREQS = ["$(PROJECT_NAME).elf"]
LSS_TARGET_CMDS = ["$(QUOTE)$(OBJDUMP)$(QUOTE) -h -S $(QUOTE)$<$(QUOTE) > $(QUOTE)$@$(QUOTE)"]
CLEAN_CMDS = ["rm -f $(PROJECT_NAME).a",
"rm -f $(PROJECT_NAME).lss",
"rm -f $(PROJECT_NAME).srec",
"rm -f $(PROJECT_NAME).map",
"rm -f $(PROJECT_NAME).eep"]
CLEAN_CMDS = ["@rm -f $(PROJECT_NAME).a",
"@rm -f $(PROJECT_NAME).lss",
"@rm -f $(PROJECT_NAME).srec",
"@rm -f $(PROJECT_NAME).map",
"@rm -f $(PROJECT_NAME).eep"]
[arch.arm.samd21a]
MCPU = "cortex-m0plus"
@ -305,3 +310,33 @@ OBJCOPY = "arm-none-eabi-objcopy"
OBJDUMP = "arm-none-eabi-objdump"
SIZE = "arm-none-eabi-gdb"
AS = "arm-none-eabi-as"
[arch.riscv]
TOOLCHAIN = "${ESF_DIR}/toolchains/riscv/bin/riscv64-unknown-elf"
CFLAGS = ["-x c", "-DDEBUG", "-Os",
"-g3",
"-Wall",
"-c",
"-std=gnu11",
"-fno-diagnostics-show-caret",
"-fdata-sections",
"-ffunction-sections",
"-funsigned-bitfields",
"$(DIR_INCLUDES)",
"-MD -MP",
"-MT$(QUOTE)$(@:%.o=%.o)$(QUOTE)",
"-MF$(QUOTE)$(@:%.o=%.d)$(QUOTE)"]
ELF_FLAGS = ["-nostartfiles",
"-Wl,--gc-sections",
"-Wl,--script=$(LD_SCRIPT)"]
LD_PATH = "../../../ESF/ld"
[arch.riscv.fe310]
[arch.riscv.fe310g]
CFLAGS = ["-DF_CPU=256000000"]
[arch.riscv.fe310g.fe310g000]
LD_SCRIPT = "$(LD_PATH)/fe310g000.ld"
[arch.riscv.fe310g.fe310g002]
MCU = "__FE310G002__"
LD_SCRIPT = "$(LD_PATH)/fe310g002.ld"
OBJS = ["ESF/mcu/src/startup_fe310.o"]
OBJS_AS_ARGS = ["$(QUOTE)ESF/mcu/src/startup_fe310.o$(QUOTE)"]

@ -44,6 +44,11 @@ same70q19a = "arch.arm.same70a.same70q19a"
same70q20a = "arch.arm.same70a.same70q20a"
same70q21a = "arch.arm.same70a.same70q21a"
# fe310 family
# fe310g series
fe310g000 = "arch.riscv.fe310g.fe310g000"
fe310g002 = "arch.riscv.fe310g.fe310g002"
# target.cfg contains the file locations for all config manifests for all mcus
# target.cfg contains things like symlinks
[target.manifest]
@ -91,3 +96,8 @@ same70n21a = "arch/arm/SAME70/SAME70A/manifest/same70n20a.toml"
same70q19a = "arch/arm/SAME70/SAME70A/manifest/same70q21a.toml"
same70q20a = "arch/arm/SAME70/SAME70A/manifest/same70q20a.toml"
same70q21a = "arch/arm/SAME70/SAME70A/manifest/same70q21a.toml"
# fe310 family
# fe310g series
fe310g000 = "arch/riscv/FE310/FE310_G/manifest/fe310g.toml"
fe310g002 = "arch/riscv/FE310/FE310_G/manifest/fe310g.toml"

@ -0,0 +1,7 @@
set pagination off
set logging file gdb.txt
set logging on
set remotetimeout 1
target extended-remote localhost:3333
load
monitor reset

@ -0,0 +1,11 @@
set pagination off
set logging file gdb.txt
set logging redirect on
set logging on
set remotetimeout 1
target extended-remote localhost:3333
load
monitor reset
q
y

@ -0,0 +1,116 @@
#! /bin/sh
# Add a .gdb_index section to a file.
# Copyright (C) 2010-2019 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# This program assumes gdb and objcopy are in $PATH.
# If not, or you want others, pass the following in the environment
GDB=${GDB:=gdb}
OBJCOPY=${OBJCOPY:=objcopy}
myname="${0##*/}"
dwarf5=""
if [ "$1" = "-dwarf-5" ]; then
dwarf5="$1"
shift
fi
if test $# != 1; then
echo "usage: $myname [-dwarf-5] FILE" 1>&2
exit 1
fi
file="$1"
if test ! -r "$file"; then
echo "$myname: unable to access: $file" 1>&2
exit 1
fi
dir="${file%/*}"
test "$dir" = "$file" && dir="."
index4="${file}.gdb-index"
index5="${file}.debug_names"
debugstr="${file}.debug_str"
debugstrmerge="${file}.debug_str.merge"
debugstrerr="${file}.debug_str.err"
rm -f $index4 $index5 $debugstr $debugstrmerge $debugstrerr
# Ensure intermediate index file is removed when we exit.
trap "rm -f $index4 $index5 $debugstr $debugstrmerge $debugstrerr" 0
$GDB --batch -nx -iex 'set auto-load no' \
-ex "file $file" -ex "save gdb-index $dwarf5 $dir" || {
# Just in case.
status=$?
echo "$myname: gdb error generating index for $file" 1>&2
exit $status
}
# In some situations gdb can exit without creating an index. This is
# not an error.
# E.g., if $file is stripped. This behaviour is akin to stripping an
# already stripped binary, it's a no-op.
status=0
if test -f "$index4" -a -f "$index5"; then
echo "$myname: Both index types were created for $file" 1>&2
status=1
elif test -f "$index4" -o -f "$index5"; then
if test -f "$index4"; then
index="$index4"
section=".gdb_index"
else
index="$index5"
section=".debug_names"
fi
debugstradd=false
debugstrupdate=false
if test -s "$debugstr"; then
if ! $OBJCOPY --dump-section .debug_str="$debugstrmerge" "$file" /dev/null \
2>$debugstrerr; then
cat >&2 $debugstrerr
exit 1
fi
if grep -q "can't dump section '.debug_str' - it does not exist" \
$debugstrerr; then
debugstradd=true
else
debugstrupdate=true
cat >&2 $debugstrerr
fi
cat "$debugstr" >>"$debugstrmerge"
fi
$OBJCOPY --add-section $section="$index" \
--set-section-flags $section=readonly \
$(if $debugstradd; then \
echo --add-section .debug_str="$debugstrmerge"; \
echo --set-section-flags .debug_str=readonly; \
fi; \
if $debugstrupdate; then \
echo --update-section .debug_str="$debugstrmerge"; \
fi) \
"$file" "$file"
status=$?
else
echo "$myname: No index was created for $file" 1>&2
echo "$myname: [Was there no debuginfo? Was there already an index?]" 1>&2
fi
exit $status

@ -0,0 +1,116 @@
#! /bin/sh
# Add a .gdb_index section to a file.
# Copyright (C) 2010-2019 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# This program assumes gdb and objcopy are in $PATH.
# If not, or you want others, pass the following in the environment
GDB=${GDB:=gdb}
OBJCOPY=${OBJCOPY:=objcopy}
myname="${0##*/}"
dwarf5=""
if [ "$1" = "-dwarf-5" ]; then
dwarf5="$1"
shift
fi
if test $# != 1; then
echo "usage: $myname [-dwarf-5] FILE" 1>&2
exit 1
fi
file="$1"
if test ! -r "$file"; then
echo "$myname: unable to access: $file" 1>&2
exit 1
fi
dir="${file%/*}"
test "$dir" = "$file" && dir="."
index4="${file}.gdb-index"
index5="${file}.debug_names"
debugstr="${file}.debug_str"
debugstrmerge="${file}.debug_str.merge"
debugstrerr="${file}.debug_str.err"
rm -f $index4 $index5 $debugstr $debugstrmerge $debugstrerr
# Ensure intermediate index file is removed when we exit.
trap "rm -f $index4 $index5 $debugstr $debugstrmerge $debugstrerr" 0
$GDB --batch -nx -iex 'set auto-load no' \
-ex "file $file" -ex "save gdb-index $dwarf5 $dir" || {
# Just in case.
status=$?
echo "$myname: gdb error generating index for $file" 1>&2
exit $status
}
# In some situations gdb can exit without creating an index. This is
# not an error.
# E.g., if $file is stripped. This behaviour is akin to stripping an
# already stripped binary, it's a no-op.
status=0
if test -f "$index4" -a -f "$index5"; then
echo "$myname: Both index types were created for $file" 1>&2
status=1
elif test -f "$index4" -o -f "$index5"; then
if test -f "$index4"; then
index="$index4"
section=".gdb_index"
else
index="$index5"
section=".debug_names"
fi
debugstradd=false
debugstrupdate=false
if test -s "$debugstr"; then
if ! $OBJCOPY --dump-section .debug_str="$debugstrmerge" "$file" /dev/null \
2>$debugstrerr; then
cat >&2 $debugstrerr
exit 1
fi
if grep -q "can't dump section '.debug_str' - it does not exist" \
$debugstrerr; then
debugstradd=true
else
debugstrupdate=true
cat >&2 $debugstrerr
fi
cat "$debugstr" >>"$debugstrmerge"
fi
$OBJCOPY --add-section $section="$index" \
--set-section-flags $section=readonly \
$(if $debugstradd; then \
echo --add-section .debug_str="$debugstrmerge"; \
echo --set-section-flags .debug_str=readonly; \
fi; \
if $debugstrupdate; then \
echo --update-section .debug_str="$debugstrmerge"; \
fi) \
"$file" "$file"
status=$?
else
echo "$myname: No index was created for $file" 1>&2
echo "$myname: [Was there no debuginfo? Was there already an index?]" 1>&2
fi
exit $status

File diff suppressed because it is too large Load Diff

@ -0,0 +1,102 @@
/* expat_config.h. Generated from expat_config.h.in by configure. */
/* expat_config.h.in. Generated from configure.ac by autoheader. */
/* 1234 = LIL_ENDIAN, 4321 = BIGENDIAN */
#define BYTEORDER 1234
/* Define to 1 if you have the `bcopy' function. */
#define HAVE_BCOPY 1
/* Define to 1 if you have the <dlfcn.h> header file. */
#define HAVE_DLFCN_H 1
/* Define to 1 if you have the <fcntl.h> header file. */
#define HAVE_FCNTL_H 1
/* Define to 1 if you have the `getpagesize' function. */
#define HAVE_GETPAGESIZE 1
/* Define to 1 if you have the <inttypes.h> header file. */
#define HAVE_INTTYPES_H 1
/* Define to 1 if you have the `memmove' function. */
#define HAVE_MEMMOVE 1
/* Define to 1 if you have the <memory.h> header file. */
#define HAVE_MEMORY_H 1
/* Define to 1 if you have a working `mmap' system call. */
#define HAVE_MMAP 1
/* Define to 1 if you have the <stdint.h> header file. */
#define HAVE_STDINT_H 1
/* Define to 1 if you have the <stdlib.h> header file. */
#define HAVE_STDLIB_H 1
/* Define to 1 if you have the <strings.h> header file. */
#define HAVE_STRINGS_H 1
/* Define to 1 if you have the <string.h> header file. */
#define HAVE_STRING_H 1
/* Define to 1 if you have the <sys/param.h> header file. */
#define HAVE_SYS_PARAM_H 1
/* Define to 1 if you have the <sys/stat.h> header file. */
#define HAVE_SYS_STAT_H 1
/* Define to 1 if you have the <sys/types.h> header file. */
#define HAVE_SYS_TYPES_H 1
/* Define to 1 if you have the <unistd.h> header file. */
#define HAVE_UNISTD_H 1
/* Define to the sub-directory where libtool stores uninstalled libraries. */
#define LT_OBJDIR ".libs/"
/* Define to the address where bug reports for this package should be sent. */
#define PACKAGE_BUGREPORT "expat-bugs@libexpat.org"
/* Define to the full name of this package. */
#define PACKAGE_NAME "expat"
/* Define to the full name and version of this package. */
#define PACKAGE_STRING "expat 2.2.0"
/* Define to the one symbol short name of this package. */
#define PACKAGE_TARNAME "expat"
/* Define to the home page for this package. */
#define PACKAGE_URL ""
/* Define to the version of this package. */
#define PACKAGE_VERSION "2.2.0"
/* Define to 1 if you have the ANSI C header files. */
#define STDC_HEADERS 1
/* whether byteorder is bigendian */
/* #undef WORDS_BIGENDIAN */
/* Define to specify how much context to retain around the current parse
point. */
#define XML_CONTEXT_BYTES 1024
/* Define to make parameter entity parsing functionality available. */
#define XML_DTD 1
/* Define to make XML Namespaces functionality available. */
#define XML_NS 1
/* Define to __FUNCTION__ or "" if `__func__' does not conform to ANSI C. */
/* #undef __func__ */
/* Define to empty if `const' does not conform to ANSI C. */
/* #undef const */
/* Define to `long int' if <sys/types.h> does not define. */
/* #undef off_t */
/* Define to `unsigned int' if <sys/types.h> does not define. */
/* #undef size_t */

@ -0,0 +1,129 @@
/* Copyright (c) 1998, 1999, 2000 Thai Open Source Software Center Ltd
See the file COPYING for copying permission.
*/
#ifndef Expat_External_INCLUDED
#define Expat_External_INCLUDED 1
/* External API definitions */
#if defined(_MSC_EXTENSIONS) && !defined(__BEOS__) && !defined(__CYGWIN__)
#define XML_USE_MSC_EXTENSIONS 1
#endif
/* Expat tries very hard to make the API boundary very specifically
defined. There are two macros defined to control this boundary;
each of these can be defined before including this header to
achieve some different behavior, but doing so it not recommended or
tested frequently.
XMLCALL - The calling convention to use for all calls across the
"library boundary." This will default to cdecl, and
try really hard to tell the compiler that's what we
want.
XMLIMPORT - Whatever magic is needed to note that a function is
to be imported from a dynamically loaded library
(.dll, .so, or .sl, depending on your platform).
The XMLCALL macro was added in Expat 1.95.7. The only one which is
expected to be directly useful in client code is XMLCALL.
Note that on at least some Unix versions, the Expat library must be
compiled with the cdecl calling convention as the default since
system headers may assume the cdecl convention.
*/
#ifndef XMLCALL
#if defined(_MSC_VER)
#define XMLCALL __cdecl
#elif defined(__GNUC__) && defined(__i386) && !defined(__INTEL_COMPILER)
#define XMLCALL __attribute__((cdecl))
#else
/* For any platform which uses this definition and supports more than
one calling convention, we need to extend this definition to
declare the convention used on that platform, if it's possible to
do so.
If this is the case for your platform, please file a bug report
with information on how to identify your platform via the C
pre-processor and how to specify the same calling convention as the
platform's malloc() implementation.
*/
#define XMLCALL
#endif
#endif /* not defined XMLCALL */
#if !defined(XML_STATIC) && !defined(XMLIMPORT)
#ifndef XML_BUILDING_EXPAT
/* using Expat from an application */
#ifdef XML_USE_MSC_EXTENSIONS
#define XMLIMPORT __declspec(dllimport)
#endif
#endif
#endif /* not defined XML_STATIC */
#if !defined(XMLIMPORT) && defined(__GNUC__) && (__GNUC__ >= 4)
#define XMLIMPORT __attribute__ ((visibility ("default")))
#endif
/* If we didn't define it above, define it away: */
#ifndef XMLIMPORT
#define XMLIMPORT
#endif
#if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96))
#define XML_ATTR_MALLOC __attribute__((__malloc__))
#else
#define XML_ATTR_MALLOC
#endif
#if defined(__GNUC__) && ((__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
#define XML_ATTR_ALLOC_SIZE(x) __attribute__((__alloc_size__(x)))
#else
#define XML_ATTR_ALLOC_SIZE(x)
#endif
#define XMLPARSEAPI(type) XMLIMPORT type XMLCALL
#ifdef __cplusplus
extern "C" {
#endif
#ifdef XML_UNICODE_WCHAR_T
#define XML_UNICODE
#endif
#ifdef XML_UNICODE /* Information is UTF-16 encoded. */
#ifdef XML_UNICODE_WCHAR_T
typedef wchar_t XML_Char;
typedef wchar_t XML_LChar;
#else
typedef unsigned short XML_Char;
typedef char XML_LChar;
#endif /* XML_UNICODE_WCHAR_T */
#else /* Information is UTF-8 encoded. */
typedef char XML_Char;
typedef char XML_LChar;
#endif /* XML_UNICODE */
#ifdef XML_LARGE_SIZE /* Use large integers for file/stream positions. */
#if defined(XML_USE_MSC_EXTENSIONS) && _MSC_VER < 1400
typedef __int64 XML_Index;
typedef unsigned __int64 XML_Size;
#else
typedef long long XML_Index;
typedef unsigned long long XML_Size;
#endif
#else
typedef long XML_Index;
typedef unsigned long XML_Size;
#endif /* XML_LARGE_SIZE */
#ifdef __cplusplus
}
#endif
#endif /* not Expat_External_INCLUDED */

@ -0,0 +1,346 @@
/* JIT declarations for GDB, the GNU Debugger.
Copyright (C) 2011-2019 Free Software Foundation, Inc.
This file is part of GDB.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#ifndef GDB_JIT_READER_H
#define GDB_JIT_READER_H
#ifdef __cplusplus
extern "C" {
#endif
/* Versioning information. See gdb_reader_funcs. */
#define GDB_READER_INTERFACE_VERSION 1
/* Readers must be released under a GPL compatible license. To
declare that the reader is indeed released under a GPL compatible
license, invoke the macro GDB_DECLARE_GPL_COMPATIBLE in a source
file. */
#ifdef __cplusplus
#define GDB_DECLARE_GPL_COMPATIBLE_READER \
extern "C" { \
extern int plugin_is_GPL_compatible (void); \
extern int plugin_is_GPL_compatible (void) \
{ \
return 0; \
} \
}
#else
#define GDB_DECLARE_GPL_COMPATIBLE_READER \
extern int plugin_is_GPL_compatible (void); \
extern int plugin_is_GPL_compatible (void) \
{ \
return 0; \
}
#endif
/* Represents an address on the target system. */
typedef unsigned long GDB_CORE_ADDR;
/* Return status codes. */
enum gdb_status {
GDB_FAIL = 0,
GDB_SUCCESS = 1
};
struct gdb_object;
struct gdb_symtab;
struct gdb_block;
struct gdb_symbol_callbacks;
/* An array of these are used to represent a map from code addresses to line
numbers in the source file. */
struct gdb_line_mapping
{
int line;
GDB_CORE_ADDR pc;
};
/* Create a new GDB code object. Each code object can have one or
more symbol tables, each representing a compiled source file. */
typedef struct gdb_object *(gdb_object_open) (struct gdb_symbol_callbacks *cb);
/* The callback used to create new symbol table. CB is the
gdb_symbol_callbacks which the structure is part of. FILE_NAME is
an (optionally NULL) file name to associate with this new symbol
table.
Returns a new instance to gdb_symtab that can later be passed to
gdb_block_new, gdb_symtab_add_line_mapping and gdb_symtab_close. */
typedef struct gdb_symtab *(gdb_symtab_open) (struct gdb_symbol_callbacks *cb,
struct gdb_object *obj,
const char *file_name);
/* Creates a new block in a given symbol table. A symbol table is a
forest of blocks, each block representing an code address range and
a corresponding (optionally NULL) NAME. In case the block
corresponds to a function, the NAME passed should be the name of
the function.
If the new block to be created is a child of (i.e. is nested in)
another block, the parent block can be passed in PARENT. SYMTAB is
the symbol table the new block is to belong in. BEGIN, END is the
code address range the block corresponds to.
Returns a new instance of gdb_block, which, as of now, has no use.
Note that the gdb_block returned must not be freed by the
caller. */
typedef struct gdb_block *(gdb_block_open) (struct gdb_symbol_callbacks *cb,
struct gdb_symtab *symtab,
struct gdb_block *parent,
GDB_CORE_ADDR begin,
GDB_CORE_ADDR end,
const char *name);
/* Adds a PC to line number mapping for the symbol table SYMTAB.
NLINES is the number of elements in LINES, each element
corresponding to one (PC, line) pair. */
typedef void (gdb_symtab_add_line_mapping) (struct gdb_symbol_callbacks *cb,
struct gdb_symtab *symtab,
int nlines,
struct gdb_line_mapping *lines);
/* Close the symtab SYMTAB. This signals to GDB that no more blocks
will be opened on this symtab. */
typedef void (gdb_symtab_close) (struct gdb_symbol_callbacks *cb,
struct gdb_symtab *symtab);
/* Closes the gdb_object OBJ and adds the emitted information into
GDB's internal structures. Once this is done, the debug
information will be picked up and used; this will usually be the
last operation in gdb_read_debug_info. */
typedef void (gdb_object_close) (struct gdb_symbol_callbacks *cb,
struct gdb_object *obj);
/* Reads LEN bytes from TARGET_MEM in the target's virtual address
space into GDB_BUF.
Returns GDB_FAIL on failure, and GDB_SUCCESS on success. */
typedef enum gdb_status (gdb_target_read) (GDB_CORE_ADDR target_mem,
void *gdb_buf, int len);
/* The list of callbacks that are passed to read. These callbacks are
to be used to construct the symbol table. The functions have been
described above. */
struct gdb_symbol_callbacks
{
gdb_object_open *object_open;
gdb_symtab_open *symtab_open;
gdb_block_open *block_open;
gdb_symtab_close *symtab_close;
gdb_object_close *object_close;
gdb_symtab_add_line_mapping *line_mapping_add;
gdb_target_read *target_read;
/* For internal use by GDB. */
void *priv_data;
};
/* Forward declaration. */
struct gdb_reg_value;
/* A function of this type is used to free a gdb_reg_value. See the
comment on `free' in struct gdb_reg_value. */
typedef void (gdb_reg_value_free) (struct gdb_reg_value *);
/* Denotes the value of a register. */
struct gdb_reg_value
{
/* The size of the register in bytes. The reader need not set this
field. This will be set for (defined) register values being read
from GDB using reg_get. */
int size;
/* Set to non-zero if the value for the register is known. The
registers for which the reader does not call reg_set are also
assumed to be undefined */
int defined;
/* Since gdb_reg_value is a variable sized structure, it will
usually be allocated on the heap. This function is expected to
contain the corresponding "free" function.
When a pointer to gdb_reg_value is being sent from GDB to the
reader (via gdb_unwind_reg_get), the reader is expected to call
this function (with the same gdb_reg_value as argument) once it
is done with the value.
When the function sends the a gdb_reg_value to GDB (via
gdb_unwind_reg_set), it is expected to set this field to point to
an appropriate cleanup routine (or to NULL if no cleanup is
required). */
gdb_reg_value_free *free;
/* The value of the register. */
unsigned char value[1];
};
/* get_frame_id in gdb_reader_funcs is to return a gdb_frame_id
corresponding to the current frame. The registers corresponding to
the current frame can be read using reg_get. Calling get_frame_id
on a particular frame should return the same gdb_frame_id
throughout its lifetime (i.e. till before it gets unwound). One
way to do this is by having the CODE_ADDRESS point to the
function's first instruction and STACK_ADDRESS point to the value
of the stack pointer when entering the function. */
struct gdb_frame_id
{
GDB_CORE_ADDR code_address;
GDB_CORE_ADDR stack_address;
};
/* Forward declaration. */
struct gdb_unwind_callbacks;
/* Returns the value of a particular register in the current frame.
The current frame is the frame that needs to be unwound into the
outer (earlier) frame.
CB is the struct gdb_unwind_callbacks * the callback belongs to.
REGNUM is the DWARF register number of the register that needs to
be unwound.
Returns the gdb_reg_value corresponding to the register requested.
In case the value of the register has been optimized away or
otherwise unavailable, the defined flag in the returned
gdb_reg_value will be zero. */
typedef struct gdb_reg_value *(gdb_unwind_reg_get)
(struct gdb_unwind_callbacks *cb, int regnum);
/* Sets the previous value of a particular register. REGNUM is the
(DWARF) register number whose value is to be set. VAL is the value
the register is to be set to.
VAL is *not* copied, so the memory allocated to it cannot be
reused. Once GDB no longer needs the value, it is deallocated
using the FREE function (see gdb_reg_value).
A register can also be "set" to an undefined value by setting the
defined in VAL to zero. */
typedef void (gdb_unwind_reg_set) (struct gdb_unwind_callbacks *cb, int regnum,
struct gdb_reg_value *val);
/* This struct is passed to unwind in gdb_reader_funcs, and is to be
used to unwind the current frame (current being the frame whose
registers can be read using reg_get) into the earlier frame. The
functions have been described above. */
struct gdb_unwind_callbacks
{
gdb_unwind_reg_get *reg_get;
gdb_unwind_reg_set *reg_set;
gdb_target_read *target_read;
/* For internal use by GDB. */
void *priv_data;
};
/* Forward declaration. */
struct gdb_reader_funcs;
/* Parse the debug info off a block of memory, pointed to by MEMORY
(already copied to GDB's address space) and MEMORY_SZ bytes long.
The implementation has to use the functions in CB to actually emit
the parsed data into GDB. SELF is the same structure returned by
gdb_init_reader.
Return GDB_FAIL on failure and GDB_SUCCESS on success. */
typedef enum gdb_status (gdb_read_debug_info) (struct gdb_reader_funcs *self,
struct gdb_symbol_callbacks *cb,
void *memory, long memory_sz);
/* Unwind the current frame, CB is the set of unwind callbacks that
are to be used to do this.
Return GDB_FAIL on failure and GDB_SUCCESS on success. */
typedef enum gdb_status (gdb_unwind_frame) (struct gdb_reader_funcs *self,
struct gdb_unwind_callbacks *cb);
/* Return the frame ID corresponding to the current frame, using C to
read the current register values. See the comment on struct
gdb_frame_id. */
typedef struct gdb_frame_id (gdb_get_frame_id) (struct gdb_reader_funcs *self,
struct gdb_unwind_callbacks *c);
/* Called when a reader is being unloaded. This function should also
free SELF, if required. */
typedef void (gdb_destroy_reader) (struct gdb_reader_funcs *self);
/* Called when the reader is loaded. Must either return a properly
populated gdb_reader_funcs or NULL. The memory allocated for the
gdb_reader_funcs is to be managed by the reader itself (i.e. if it
is allocated from the heap, it must also be freed in
gdb_destroy_reader). */
extern struct gdb_reader_funcs *gdb_init_reader (void);
/* Pointer to the functions which implement the reader's
functionality. The individual functions have been documented
above.
None of the fields are optional. */
struct gdb_reader_funcs
{
/* Must be set to GDB_READER_INTERFACE_VERSION. */
int reader_version;
/* For use by the reader. */
void *priv_data;
gdb_read_debug_info *read;
gdb_unwind_frame *unwind;
gdb_get_frame_id *get_frame_id;
gdb_destroy_reader *destroy;
};
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif

@ -0,0 +1,197 @@
/* Copyright (C) 1992-2018 Free Software Foundation, Inc.
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 3, or (at your option) any later
version.
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
Under Section 7 of GPL version 3, you are granted additional
permissions described in the GCC Runtime Library Exception, version
3.1, as published by the Free Software Foundation.
You should have received a copy of the GNU General Public License and
a copy of the GCC Runtime Library Exception along with this program;
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
/* This administrivia gets added to the beginning of limits.h
if the system has its own version of limits.h. */
/* We use _GCC_LIMITS_H_ because we want this not to match
any macros that the system's limits.h uses for its own purposes. */
#ifndef _GCC_LIMITS_H_ /* Terminated in limity.h. */
#define _GCC_LIMITS_H_
#ifndef _LIBC_LIMITS_H_
/* Use "..." so that we find syslimits.h only in this same directory. */
#include "syslimits.h"
#endif
/* Copyright (C) 1991-2018 Free Software Foundation, Inc.
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 3, or (at your option) any later
version.
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
Under Section 7 of GPL version 3, you are granted additional
permissions described in the GCC Runtime Library Exception, version
3.1, as published by the Free Software Foundation.
You should have received a copy of the GNU General Public License and
a copy of the GCC Runtime Library Exception along with this program;
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
#ifndef _LIMITS_H___
#define _LIMITS_H___
/* Number of bits in a `char'. */
#undef CHAR_BIT
#define CHAR_BIT __CHAR_BIT__
/* Maximum length of a multibyte character. */
#ifndef MB_LEN_MAX
#define MB_LEN_MAX 1
#endif
/* Minimum and maximum values a `signed char' can hold. */
#undef SCHAR_MIN
#define SCHAR_MIN (-SCHAR_MAX - 1)
#undef SCHAR_MAX
#define SCHAR_MAX __SCHAR_MAX__
/* Maximum value an `unsigned char' can hold. (Minimum is 0). */
#undef UCHAR_MAX
#if __SCHAR_MAX__ == __INT_MAX__
# define UCHAR_MAX (SCHAR_MAX * 2U + 1U)
#else
# define UCHAR_MAX (SCHAR_MAX * 2 + 1)
#endif
/* Minimum and maximum values a `char' can hold. */
#ifdef __CHAR_UNSIGNED__
# undef CHAR_MIN
# if __SCHAR_MAX__ == __INT_MAX__
# define CHAR_MIN 0U
# else
# define CHAR_MIN 0
# endif
# undef CHAR_MAX
# define CHAR_MAX UCHAR_MAX
#else
# undef CHAR_MIN
# define CHAR_MIN SCHAR_MIN
# undef CHAR_MAX
# define CHAR_MAX SCHAR_MAX
#endif
/* Minimum and maximum values a `signed short int' can hold. */
#undef SHRT_MIN
#define SHRT_MIN (-SHRT_MAX - 1)
#undef SHRT_MAX
#define SHRT_MAX __SHRT_MAX__
/* Maximum value an `unsigned short int' can hold. (Minimum is 0). */
#undef USHRT_MAX
#if __SHRT_MAX__ == __INT_MAX__
# define USHRT_MAX (SHRT_MAX * 2U + 1U)
#else
# define USHRT_MAX (SHRT_MAX * 2 + 1)
#endif
/* Minimum and maximum values a `signed int' can hold. */
#undef INT_MIN
#define INT_MIN (-INT_MAX - 1)
#undef INT_MAX
#define INT_MAX __INT_MAX__
/* Maximum value an `unsigned int' can hold. (Minimum is 0). */
#undef UINT_MAX
#define UINT_MAX (INT_MAX * 2U + 1U)
/* Minimum and maximum values a `signed long int' can hold.
(Same as `int'). */
#undef LONG_MIN
#define LONG_MIN (-LONG_MAX - 1L)
#undef LONG_MAX
#define LONG_MAX __LONG_MAX__
/* Maximum value an `unsigned long int' can hold. (Minimum is 0). */
#undef ULONG_MAX
#define ULONG_MAX (LONG_MAX * 2UL + 1UL)
#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
/* Minimum and maximum values a `signed long long int' can hold. */
# undef LLONG_MIN
# define LLONG_MIN (-LLONG_MAX - 1LL)
# undef LLONG_MAX
# define LLONG_MAX __LONG_LONG_MAX__
/* Maximum value an `unsigned long long int' can hold. (Minimum is 0). */
# undef ULLONG_MAX
# define ULLONG_MAX (LLONG_MAX * 2ULL + 1ULL)
#endif
#if defined (__GNU_LIBRARY__) ? defined (__USE_GNU) : !defined (__STRICT_ANSI__)
/* Minimum and maximum values a `signed long long int' can hold. */
# undef LONG_LONG_MIN
# define LONG_LONG_MIN (-LONG_LONG_MAX - 1LL)
# undef LONG_LONG_MAX
# define LONG_LONG_MAX __LONG_LONG_MAX__
/* Maximum value an `unsigned long long int' can hold. (Minimum is 0). */
# undef ULONG_LONG_MAX
# define ULONG_LONG_MAX (LONG_LONG_MAX * 2ULL + 1ULL)
#endif
#ifdef __STDC_WANT_IEC_60559_BFP_EXT__
/* TS 18661-1 widths of integer types. */
# undef CHAR_WIDTH
# define CHAR_WIDTH __SCHAR_WIDTH__
# undef SCHAR_WIDTH
# define SCHAR_WIDTH __SCHAR_WIDTH__
# undef UCHAR_WIDTH
# define UCHAR_WIDTH __SCHAR_WIDTH__
# undef SHRT_WIDTH
# define SHRT_WIDTH __SHRT_WIDTH__
# undef USHRT_WIDTH
# define USHRT_WIDTH __SHRT_WIDTH__
# undef INT_WIDTH
# define INT_WIDTH __INT_WIDTH__
# undef UINT_WIDTH
# define UINT_WIDTH __INT_WIDTH__
# undef LONG_WIDTH
# define LONG_WIDTH __LONG_WIDTH__
# undef ULONG_WIDTH
# define ULONG_WIDTH __LONG_WIDTH__
# undef LLONG_WIDTH
# define LLONG_WIDTH __LONG_LONG_WIDTH__
# undef ULLONG_WIDTH
# define ULLONG_WIDTH __LONG_LONG_WIDTH__
#endif
#endif /* _LIMITS_H___ */
/* This administrivia gets added to the end of limits.h
if the system has its own version of limits.h. */
#else /* not _GCC_LIMITS_H_ */
#ifdef _GCC_NEXT_LIMITS_H
#include_next <limits.h> /* recurse down to the real one */
#endif
#endif /* not _GCC_LIMITS_H_ */

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save