build hello fw with GCC Toolchain v2020.04.1 (set GPIO_IOF_EN). Remove obsolete function write_hex
This commit is contained in:
parent
830c1382b9
commit
ce24b0f2f2
|
@ -1,27 +0,0 @@
|
||||||
################################################################################
|
|
||||||
# Automatically-generated file. Do not edit!
|
|
||||||
################################################################################
|
|
||||||
|
|
||||||
# Add inputs and outputs from these tool invocations to the build variables
|
|
||||||
C_SRCS += \
|
|
||||||
../libwrap/misc/write_hex.c
|
|
||||||
|
|
||||||
O_SRCS += \
|
|
||||||
../libwrap/misc/write_hex.o
|
|
||||||
|
|
||||||
OBJS += \
|
|
||||||
./libwrap/misc/write_hex.o
|
|
||||||
|
|
||||||
C_DEPS += \
|
|
||||||
./libwrap/misc/write_hex.d
|
|
||||||
|
|
||||||
|
|
||||||
# Each subdirectory must supply rules for building sources it contributes
|
|
||||||
libwrap/misc/%.o: ../libwrap/misc/%.c
|
|
||||||
@echo 'Building file: $<'
|
|
||||||
@echo 'Invoking: Cross GCC Compiler'
|
|
||||||
riscv32-unknown-elf-gcc -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -o "$@" "$<"
|
|
||||||
@echo 'Finished building: $<'
|
|
||||||
@echo ' '
|
|
||||||
|
|
||||||
|
|
|
@ -76,6 +76,4 @@
|
||||||
|
|
||||||
#define RTC_FREQ 32768
|
#define RTC_FREQ 32768
|
||||||
|
|
||||||
void write_hex(int fd, uint32_t hex);
|
|
||||||
|
|
||||||
#endif /* _SIFIVE_HIFIVE1_H */
|
#endif /* _SIFIVE_HIFIVE1_H */
|
||||||
|
|
|
@ -25,8 +25,7 @@ LIBWRAP_SRCS := \
|
||||||
sys/isatty.c \
|
sys/isatty.c \
|
||||||
sys/times.c \
|
sys/times.c \
|
||||||
sys/sbrk.c \
|
sys/sbrk.c \
|
||||||
sys/_exit.c \
|
sys/_exit.c
|
||||||
misc/write_hex.c
|
|
||||||
|
|
||||||
LIBWRAP_SRCS := $(foreach f,$(LIBWRAP_SRCS),$(LIBWRAP_DIR)/$(f))
|
LIBWRAP_SRCS := $(foreach f,$(LIBWRAP_SRCS),$(LIBWRAP_DIR)/$(f))
|
||||||
LIBWRAP_OBJS := $(LIBWRAP_SRCS:.c=.o)
|
LIBWRAP_OBJS := $(LIBWRAP_SRCS:.c=.o)
|
||||||
|
|
|
@ -1,19 +0,0 @@
|
||||||
/* See LICENSE of license details. */
|
|
||||||
|
|
||||||
#include <stdint.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
#include "platform.h"
|
|
||||||
|
|
||||||
void write_hex(int fd, uint32_t hex)
|
|
||||||
{
|
|
||||||
uint8_t ii;
|
|
||||||
uint8_t jj;
|
|
||||||
char towrite;
|
|
||||||
write(fd , "0x", 2);
|
|
||||||
for (ii = 8 ; ii > 0; ii--) {
|
|
||||||
jj = ii - 1;
|
|
||||||
uint8_t digit = ((hex & (0xF << (jj*4))) >> (jj*4));
|
|
||||||
towrite = digit < 0xA ? ('0' + digit) : ('A' + (digit - 0xA));
|
|
||||||
write(fd, &towrite, 1);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -10,7 +10,6 @@ void __wrap__exit(int code)
|
||||||
//*leds = (~(code));
|
//*leds = (~(code));
|
||||||
|
|
||||||
write(STDERR_FILENO, message, sizeof(message) - 1);
|
write(STDERR_FILENO, message, sizeof(message) - 1);
|
||||||
write_hex(STDERR_FILENO, code);
|
|
||||||
write(STDERR_FILENO, "\n", 1);
|
write(STDERR_FILENO, "\n", 1);
|
||||||
|
|
||||||
for (;;);
|
for (;;);
|
||||||
|
|
BIN
hello/hello
BIN
hello/hello
Binary file not shown.
|
@ -57,14 +57,17 @@ unsigned read_adc(unsigned index){
|
||||||
return result&0x03ff;
|
return result&0x03ff;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//int read_csr(int csr_num) __attribute__((always_inline)) {
|
||||||
extern void write_hex(int fd, uint32_t hex);
|
// int result;
|
||||||
|
// asm("csrr %0, %1" : "=r"(result) : "I"(csr_num));
|
||||||
|
// return result;
|
||||||
|
//}
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
write_hex(1, 0x55aa);
|
GPIO_REG(GPIO_IOF_EN) |= 0x30000;
|
||||||
volatile int result = factorial (10);
|
int result = factorial (10);
|
||||||
printf("Factorial is %d\n", result);
|
printf("Factorial of 10 is %d\n", result);
|
||||||
for(unsigned i=0; i<8; ++i)
|
for(unsigned i=0; i<8; ++i)
|
||||||
printf("ADC%u value read is %u\n", i, read_adc(i));
|
printf("ADC%u value read is %u\n", i, read_adc(i));
|
||||||
printf("End of execution");
|
printf("End of execution");
|
||||||
|
|
4359
hello/hello.dis
4359
hello/hello.dis
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue