mirror of
https://github.com/RobotechLille/cdf2018-principal
synced 2024-11-23 08:36:03 +01:00
Commit initial
This commit is contained in:
commit
e0cb79d1cc
15
.gitmodules
vendored
Normal file
15
.gitmodules
vendored
Normal file
|
@ -0,0 +1,15 @@
|
|||
[submodule "root/buildroot"]
|
||||
path = root/buildroot
|
||||
url = git://git.buildroot.net/buildroot
|
||||
[submodule "ardPince/Arduino-Makefile"]
|
||||
path = ardPince/Arduino-Makefile
|
||||
url = https://github.com/sudar/Arduino-Makefile
|
||||
[submodule "ardMoteur/Arduino-Makefile"]
|
||||
path = ardMoteur/Arduino-Makefile
|
||||
url = https://github.com/sudar/Arduino-Makefile
|
||||
[submodule "fpga/uart"]
|
||||
path = fpga/uart
|
||||
url = https://github.com/pabennett/uart.git
|
||||
[submodule "raspberrypi/buildroot"]
|
||||
path = raspberrypi/buildroot
|
||||
url = /home/geoffrey/buildroot
|
16
arduino/.gitignore
vendored
Normal file
16
arduino/.gitignore
vendored
Normal file
|
@ -0,0 +1,16 @@
|
|||
FreeRTOSv9.0.0/*
|
||||
*.zip
|
||||
|
||||
*.o
|
||||
*.lst
|
||||
*.d
|
||||
*.hex
|
||||
*.eep
|
||||
*.obj
|
||||
*.elf
|
||||
*.map
|
||||
*.obj
|
||||
*.a90
|
||||
*.sym
|
||||
*.lnk
|
||||
*.lss
|
121
arduino/FreeRTOSConfig.h
Normal file
121
arduino/FreeRTOSConfig.h
Normal file
|
@ -0,0 +1,121 @@
|
|||
/*
|
||||
FreeRTOS V8.1.2 - Copyright (C) 2014 Real Time Engineers Ltd.
|
||||
All rights reserved
|
||||
|
||||
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
||||
|
||||
***************************************************************************
|
||||
* *
|
||||
* FreeRTOS provides completely free yet professionally developed, *
|
||||
* robust, strictly quality controlled, supported, and cross *
|
||||
* platform software that has become a de facto standard. *
|
||||
* *
|
||||
* Help yourself get started quickly and support the FreeRTOS *
|
||||
* project by purchasing a FreeRTOS tutorial book, reference *
|
||||
* manual, or both from: http://www.FreeRTOS.org/Documentation *
|
||||
* *
|
||||
* Thank you! *
|
||||
* *
|
||||
***************************************************************************
|
||||
|
||||
This file is part of the FreeRTOS distribution.
|
||||
|
||||
FreeRTOS is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License (version 2) as published by the
|
||||
Free Software Foundation >>!AND MODIFIED BY!<< the FreeRTOS exception.
|
||||
|
||||
>>! NOTE: The modification to the GPL is included to allow you to !<<
|
||||
>>! distribute a combined work that includes FreeRTOS without being !<<
|
||||
>>! obliged to provide the source code for proprietary components !<<
|
||||
>>! outside of the FreeRTOS kernel. !<<
|
||||
|
||||
FreeRTOS 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. Full license text is available from the following
|
||||
link: http://www.freertos.org/a00114.html
|
||||
|
||||
1 tab == 4 spaces!
|
||||
|
||||
***************************************************************************
|
||||
* *
|
||||
* Having a problem? Start by reading the FAQ "My application does *
|
||||
* not run, what could be wrong?" *
|
||||
* *
|
||||
* http://www.FreeRTOS.org/FAQHelp.html *
|
||||
* *
|
||||
***************************************************************************
|
||||
|
||||
http://www.FreeRTOS.org - Documentation, books, training, latest versions,
|
||||
license and Real Time Engineers Ltd. contact details.
|
||||
|
||||
http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,
|
||||
including FreeRTOS+Trace - an indispensable productivity tool, a DOS
|
||||
compatible FAT file system, and our tiny thread aware UDP/IP stack.
|
||||
|
||||
http://www.OpenRTOS.com - Real Time Engineers ltd license FreeRTOS to High
|
||||
Integrity Systems to sell under the OpenRTOS brand. Low cost OpenRTOS
|
||||
licenses offer ticketed support, indemnification and middleware.
|
||||
|
||||
http://www.SafeRTOS.com - High Integrity Systems also provide a safety
|
||||
engineered and independently SIL3 certified version for use in safety and
|
||||
mission critical applications that require provable dependability.
|
||||
|
||||
1 tab == 4 spaces!
|
||||
*/
|
||||
|
||||
#ifndef FREERTOS_CONFIG_H
|
||||
#define FREERTOS_CONFIG_H
|
||||
|
||||
#include <avr/io.h>
|
||||
|
||||
/*-----------------------------------------------------------
|
||||
* Application specific definitions.
|
||||
*
|
||||
* These definitions should be adjusted for your particular hardware and
|
||||
* application requirements.
|
||||
*
|
||||
* THESE PARAMETERS ARE DESCRIBED WITHIN THE 'CONFIGURATION' SECTION OF THE
|
||||
* FreeRTOS API DOCUMENTATION AVAILABLE ON THE FreeRTOS.org WEB SITE.
|
||||
*
|
||||
* See http://www.freertos.org/a00110.html.
|
||||
*----------------------------------------------------------*/
|
||||
|
||||
// JF: added
|
||||
#define configUSE_TIMERS 1
|
||||
#define configTIMER_TASK_PRIORITY 3
|
||||
#define configTIMER_QUEUE_LENGTH 10
|
||||
#define configTIMER_TASK_STACK_DEPTH configMINIMAL_STACK_SIZE
|
||||
// -- done
|
||||
|
||||
#define configUSE_PREEMPTION 1
|
||||
#define configUSE_IDLE_HOOK 0
|
||||
#define configUSE_TICK_HOOK 0
|
||||
#define configCPU_CLOCK_HZ ( ( unsigned long ) 16000000 )
|
||||
#define configTICK_RATE_HZ ( ( TickType_t ) 1000 )
|
||||
#define configMAX_PRIORITIES ( 4 )
|
||||
#define configMINIMAL_STACK_SIZE ( ( unsigned short ) 85 )
|
||||
#define configTOTAL_HEAP_SIZE ( (size_t ) ( 4096 ) )
|
||||
#define configMAX_TASK_NAME_LEN ( 16 )
|
||||
#define configUSE_TRACE_FACILITY 0
|
||||
#define configUSE_16_BIT_TICKS 1
|
||||
#define configIDLE_SHOULD_YIELD 1
|
||||
#define configQUEUE_REGISTRY_SIZE 0
|
||||
|
||||
/* Co-routine definitions. */
|
||||
#define configUSE_CO_ROUTINES 1
|
||||
#define configMAX_CO_ROUTINE_PRIORITIES ( 2 )
|
||||
|
||||
/* Set the following definitions to 1 to include the API function, or zero
|
||||
to exclude the API function. */
|
||||
|
||||
#define INCLUDE_vTaskPrioritySet 1
|
||||
#define INCLUDE_uxTaskPriorityGet 1
|
||||
//##If the following value is set to 1, change the memory managment scheme to heap_2.c:
|
||||
#define INCLUDE_vTaskDelete 0
|
||||
#define INCLUDE_vTaskCleanUpResources 0
|
||||
#define INCLUDE_vTaskSuspend 1
|
||||
#define INCLUDE_vTaskDelayUntil 1
|
||||
#define INCLUDE_vTaskDelay 1
|
||||
|
||||
|
||||
#endif /* FREERTOS_CONFIG_H */
|
260
arduino/Makefile
Normal file
260
arduino/Makefile
Normal file
|
@ -0,0 +1,260 @@
|
|||
# WinAVR Sample makefile written by Eric B. Weddington, Jörg Wunsch, et al.
|
||||
# Edited by J. Forget
|
||||
# Released to the Public Domain
|
||||
# Please read the make user manual!
|
||||
#
|
||||
# Additional material for this makefile was submitted by:
|
||||
# Tim Henigan
|
||||
# Peter Fleury
|
||||
# Reiner Patommel
|
||||
# Sander Pool
|
||||
# Frederik Rouleau
|
||||
# Markus Pfaff
|
||||
#
|
||||
# On command line:
|
||||
#
|
||||
# make NAME=bla.c : compile program bla.c
|
||||
#
|
||||
# make clean : Clean out built project files.
|
||||
#
|
||||
# make upload : Load the hex file to the device, using avrdude. Please
|
||||
# customize the avrdude settings below first!
|
||||
#
|
||||
|
||||
# MCU name
|
||||
MCU = atmega2560
|
||||
|
||||
# Output format. (can be srec, ihex, binary)
|
||||
FORMAT = ihex
|
||||
|
||||
# Target file name (without extension).
|
||||
TARGET = principal
|
||||
|
||||
# Custom
|
||||
NAME = $(TARGET).c
|
||||
|
||||
# List C source files here. (C dependencies are automatically generated.)
|
||||
INSTALL_DIR=./FreeRTOSv9.0.0/FreeRTOS
|
||||
#DEMO_DIR = $(INSTALL_DIR)/Demo/
|
||||
SOURCE_DIR = $(INSTALL_DIR)/Source
|
||||
PORT_DIR = .
|
||||
|
||||
SRC = \
|
||||
$(NAME) \
|
||||
$(SOURCE_DIR)/tasks.c \
|
||||
$(SOURCE_DIR)/queue.c \
|
||||
$(SOURCE_DIR)/list.c \
|
||||
$(SOURCE_DIR)/timers.c \
|
||||
$(SOURCE_DIR)/croutine.c \
|
||||
$(SOURCE_DIR)/portable/MemMang/heap_1.c \
|
||||
$(PORT_DIR)/port.c
|
||||
|
||||
|
||||
DEBUG_LEVEL=-g
|
||||
WARNINGS=-Wall
|
||||
|
||||
CFLAGS = -D GCC_MEGA_AVR -I. -I$(SOURCE_DIR)/include -I$(DEMO_DIR)/Common/include \
|
||||
$(DEBUG_LEVEL) \
|
||||
-fsigned-char -funsigned-bitfields -fpack-struct -fshort-enums \
|
||||
$(WARNINGS) \
|
||||
-Wa,-adhlns=$(<:.c=.lst) \
|
||||
$(patsubst %,-I%,$(EXTRAINCDIRS))
|
||||
|
||||
# Optional linker flags.
|
||||
# -Wl,...: tell GCC to pass this to linker.
|
||||
# -Map: create map file
|
||||
# --cref: add cross reference to map file
|
||||
LDFLAGS = -Wl,-Map=$(TARGET).map,--cref
|
||||
|
||||
|
||||
# Programming support using avrdude. Settings and variables.
|
||||
|
||||
# Programming hardware: alf avr910 avrisp bascom bsd
|
||||
# dt006 pavr picoweb pony-stk200 sp12 stk200 stk500
|
||||
#
|
||||
# Type: avrdude -c ?
|
||||
# to get a full listing.
|
||||
#
|
||||
AVRDUDE_PROGRAMMER = stk500
|
||||
|
||||
AVRDUDE_PORT = /dev/ttyACM0 # programmer connected to serial device
|
||||
|
||||
AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex
|
||||
|
||||
AVRDUDE_FLAGS = -p $(MCU) -P $(AVRDUDE_PORT) -c $(AVRDUDE_PROGRAMMER) -D
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
# Define programs and commands.
|
||||
SHELL = sh
|
||||
|
||||
CC = avr-gcc
|
||||
|
||||
OBJCOPY = avr-objcopy
|
||||
OBJDUMP = avr-objdump
|
||||
SIZE = avr-size
|
||||
|
||||
# Programming support using avrdude.
|
||||
AVRDUDE = avrdude
|
||||
|
||||
REMOVE = rm -f
|
||||
COPY = cp
|
||||
|
||||
HEXSIZE = $(SIZE) --target=$(FORMAT) $(TARGET).hex
|
||||
ELFSIZE = $(SIZE) -A $(TARGET).elf
|
||||
|
||||
# Define Messages
|
||||
# English
|
||||
MSG_ERRORS_NONE = Errors: none
|
||||
MSG_BEGIN = -------- begin --------
|
||||
MSG_END = -------- end --------
|
||||
MSG_SIZE_BEFORE = Size before:
|
||||
MSG_SIZE_AFTER = Size after:
|
||||
MSG_FLASH = Creating load file for Flash:
|
||||
MSG_EEPROM = Creating load file for EEPROM:
|
||||
MSG_EXTENDED_LISTING = Creating Extended Listing:
|
||||
MSG_SYMBOL_TABLE = Creating Symbol Table:
|
||||
MSG_LINKING = Linking:
|
||||
MSG_COMPILING = Compiling:
|
||||
MSG_ASSEMBLING = Assembling:
|
||||
MSG_CLEANING = Cleaning project:
|
||||
|
||||
# Define all object files.
|
||||
OBJ = $(SRC:.c=.o)
|
||||
|
||||
# Define all listing files.
|
||||
LST = $(SRC:.c=.lst)
|
||||
|
||||
# Combine all necessary flags and optional flags.
|
||||
# Add target processor to flags.
|
||||
ALL_CFLAGS = -mmcu=$(MCU) -I. $(CFLAGS)
|
||||
ALL_ASFLAGS = -mmcu=$(MCU) -I. -x assembler-with-cpp
|
||||
|
||||
# Default target.
|
||||
all: begin gccversion sizebefore $(TARGET).elf $(TARGET).hex $(TARGET).eep \
|
||||
$(TARGET).lss $(TARGET).sym sizeafter finished end
|
||||
|
||||
|
||||
# Eye candy.
|
||||
# AVR Studio 3.x does not check make's exit code but relies on
|
||||
# the following magic strings to be generated by the compile job.
|
||||
begin:
|
||||
@echo
|
||||
@echo $(MSG_BEGIN)
|
||||
|
||||
finished:
|
||||
@echo $(MSG_ERRORS_NONE)
|
||||
|
||||
end:
|
||||
@echo $(MSG_END)
|
||||
@echo
|
||||
|
||||
|
||||
# Program the device.
|
||||
upload: $(TARGET).hex $(TARGET).eep
|
||||
$(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM)
|
||||
|
||||
|
||||
# Create final output files (.hex, .eep) from ELF output file.
|
||||
%.hex: %.elf
|
||||
@echo
|
||||
@echo $(MSG_FLASH) $@
|
||||
$(OBJCOPY) -O $(FORMAT) -R .eeprom $< $@
|
||||
|
||||
%.eep: %.elf
|
||||
@echo
|
||||
@echo $(MSG_EEPROM) $@
|
||||
-$(OBJCOPY) -j .eeprom --set-section-flags=.eeprom="alloc,load" \
|
||||
--change-section-lma .eeprom=0 -O $(FORMAT) $< $@
|
||||
|
||||
# Create extended listing file from ELF output file.
|
||||
%.lss: %.elf
|
||||
@echo
|
||||
@echo $(MSG_EXTENDED_LISTING) $@
|
||||
$(OBJDUMP) -h -S $< > $@
|
||||
|
||||
# Create a symbol table from ELF output file.
|
||||
%.sym: %.elf
|
||||
@echo
|
||||
@echo $(MSG_SYMBOL_TABLE) $@
|
||||
avr-nm -n $< > $@
|
||||
|
||||
|
||||
|
||||
# Link: create ELF output file from object files.
|
||||
.SECONDARY : $(TARGET).elf
|
||||
.PRECIOUS : $(OBJ)
|
||||
%.elf: $(OBJ)
|
||||
@echo
|
||||
@echo $(MSG_LINKING) $@
|
||||
$(CC) $(ALL_CFLAGS) $(OBJ) --output $@ $(LDFLAGS)
|
||||
|
||||
|
||||
# Compile: create object files from C source files.
|
||||
%.o : %.c
|
||||
@echo
|
||||
@echo $(MSG_COMPILING) $<
|
||||
$(CC) -c $(ALL_CFLAGS) $< -o $@
|
||||
|
||||
|
||||
# Compile: create assembler files from C source files.
|
||||
%.s : %.c
|
||||
$(CC) -S $(ALL_CFLAGS) $< -o $@
|
||||
|
||||
|
||||
# Assemble: create object files from assembler source files.
|
||||
%.o : %.S
|
||||
@echo
|
||||
@echo $(MSG_ASSEMBLING) $<
|
||||
$(CC) -c $(ALL_ASFLAGS) $< -o $@
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# Target: clean project.
|
||||
clean: begin clean_list finished end
|
||||
|
||||
clean_list :
|
||||
@echo
|
||||
@echo $(MSG_CLEANING)
|
||||
$(REMOVE) $(TARGET).hex
|
||||
$(REMOVE) $(TARGET).eep
|
||||
$(REMOVE) $(TARGET).obj
|
||||
$(REMOVE) $(TARGET).elf
|
||||
$(REMOVE) $(TARGET).map
|
||||
$(REMOVE) $(TARGET).obj
|
||||
$(REMOVE) $(TARGET).a90
|
||||
$(REMOVE) $(TARGET).sym
|
||||
$(REMOVE) $(TARGET).lnk
|
||||
$(REMOVE) $(TARGET).lss
|
||||
$(REMOVE) $(OBJ)
|
||||
$(REMOVE) $(LST)
|
||||
$(REMOVE) $(SRC:.c=.s)
|
||||
$(REMOVE) $(SRC:.c=.d)
|
||||
|
||||
|
||||
# Automatically generate C source code dependencies.
|
||||
# (Code originally taken from the GNU make user manual and modified
|
||||
# (See README.txt Credits).)
|
||||
#
|
||||
# Note that this will work with sh (bash) and sed that is shipped with WinAVR
|
||||
# (see the SHELL variable defined above).
|
||||
# This may not work with other shells or other seds.
|
||||
#
|
||||
%.d: %.c
|
||||
set -e; $(CC) -MM $(ALL_CFLAGS) $< \
|
||||
| sed 's,\(.*\)\.o[ :]*,\1.o \1.d : ,g' > $@; \
|
||||
[ -s $@ ] || rm -f $@
|
||||
|
||||
|
||||
# Remove the '-' if you want to see the dependency files generated.
|
||||
-include $(SRC:.c=.d)
|
||||
|
||||
|
||||
|
||||
# Listing of phony targets.
|
||||
.PHONY : all begin finish end sizebefore sizeafter gccversion \
|
||||
clean clean_list program
|
||||
|
6
arduino/configure
vendored
Executable file
6
arduino/configure
vendored
Executable file
|
@ -0,0 +1,6 @@
|
|||
#!/usr/bin/env sh
|
||||
|
||||
wget "https://sourceforge.net/projects/freertos/files/FreeRTOS/V9.0.0/FreeRTOSv9.0.0.zip/download" -O FreeRTOSv9.0.0.zip -c
|
||||
unzip "FreeRTOSv9.0.0.zip"
|
||||
rm "FreeRTOSv9.0.0.zip"
|
||||
|
463
arduino/port.c
Normal file
463
arduino/port.c
Normal file
|
@ -0,0 +1,463 @@
|
|||
/*
|
||||
FreeRTOS V8.1.2 - Copyright (C) 2014 Real Time Engineers Ltd.
|
||||
All rights reserved
|
||||
|
||||
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
||||
|
||||
***************************************************************************
|
||||
* *
|
||||
* FreeRTOS provides completely free yet professionally developed, *
|
||||
* robust, strictly quality controlled, supported, and cross *
|
||||
* platform software that has become a de facto standard. *
|
||||
* *
|
||||
* Help yourself get started quickly and support the FreeRTOS *
|
||||
* project by purchasing a FreeRTOS tutorial book, reference *
|
||||
* manual, or both from: http://www.FreeRTOS.org/Documentation *
|
||||
* *
|
||||
* Thank you! *
|
||||
* *
|
||||
***************************************************************************
|
||||
|
||||
This file is part of the FreeRTOS distribution.
|
||||
|
||||
FreeRTOS is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License (version 2) as published by the
|
||||
Free Software Foundation >>!AND MODIFIED BY!<< the FreeRTOS exception.
|
||||
|
||||
>>! NOTE: The modification to the GPL is included to allow you to !<<
|
||||
>>! distribute a combined work that includes FreeRTOS without being !<<
|
||||
>>! obliged to provide the source code for proprietary components !<<
|
||||
>>! outside of the FreeRTOS kernel. !<<
|
||||
|
||||
FreeRTOS 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. Full license text is available from the following
|
||||
link: http://www.freertos.org/a00114.html
|
||||
|
||||
1 tab == 4 spaces!
|
||||
|
||||
***************************************************************************
|
||||
* *
|
||||
* Having a problem? Start by reading the FAQ "My application does *
|
||||
* not run, what could be wrong?" *
|
||||
* *
|
||||
* http://www.FreeRTOS.org/FAQHelp.html *
|
||||
* *
|
||||
***************************************************************************
|
||||
|
||||
http://www.FreeRTOS.org - Documentation, books, training, latest versions,
|
||||
license and Real Time Engineers Ltd. contact details.
|
||||
|
||||
http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,
|
||||
including FreeRTOS+Trace - an indispensable productivity tool, a DOS
|
||||
compatible FAT file system, and our tiny thread aware UDP/IP stack.
|
||||
|
||||
http://www.OpenRTOS.com - Real Time Engineers ltd license FreeRTOS to High
|
||||
Integrity Systems to sell under the OpenRTOS brand. Low cost OpenRTOS
|
||||
licenses offer ticketed support, indemnification and middleware.
|
||||
|
||||
http://www.SafeRTOS.com - High Integrity Systems also provide a safety
|
||||
engineered and independently SIL3 certified version for use in safety and
|
||||
mission critical applications that require provable dependability.
|
||||
|
||||
1 tab == 4 spaces!
|
||||
*/
|
||||
|
||||
/*
|
||||
|
||||
Changes from V2.6.0
|
||||
|
||||
+ AVR port - Replaced the inb() and outb() functions with direct memory
|
||||
access. This allows the port to be built with the 20050414 build of
|
||||
WinAVR.
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <avr/interrupt.h>
|
||||
|
||||
#include "FreeRTOS.h"
|
||||
#include "task.h"
|
||||
|
||||
/*-----------------------------------------------------------
|
||||
* Implementation of functions defined in portable.h for the AVR port.
|
||||
*----------------------------------------------------------*/
|
||||
|
||||
/* Start tasks with interrupts enables. */
|
||||
#define portFLAGS_INT_ENABLED ( ( StackType_t ) 0x80 )
|
||||
|
||||
/* Hardware constants for timer 1. */
|
||||
#define portCLEAR_COUNTER_ON_MATCH ( ( uint8_t ) 0x08 )
|
||||
#define portPRESCALE_64 ( ( uint8_t ) 0x03 )
|
||||
#define portCLOCK_PRESCALER ( ( uint32_t ) 64 )
|
||||
#define portCOMPARE_MATCH_A_INTERRUPT_ENABLE ( ( uint8_t ) 0x02 )
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* We require the address of the pxCurrentTCB variable, but don't want to know
|
||||
any details of its type. */
|
||||
typedef void TCB_t;
|
||||
extern volatile TCB_t * volatile pxCurrentTCB;
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/*
|
||||
* Macro to save all the general purpose registers, the save the stack pointer
|
||||
* into the TCB.
|
||||
*
|
||||
* The first thing we do is save the flags then disable interrupts. This is to
|
||||
* guard our stack against having a context switch interrupt after we have already
|
||||
* pushed the registers onto the stack - causing the 32 registers to be on the
|
||||
* stack twice.
|
||||
*
|
||||
* r1 is set to zero as the compiler expects it to be thus, however some
|
||||
* of the math routines make use of R1.
|
||||
*
|
||||
* The interrupts will have been disabled during the call to portSAVE_CONTEXT()
|
||||
* so we need not worry about reading/writing to the stack pointer.
|
||||
*/
|
||||
|
||||
#define portSAVE_CONTEXT() \
|
||||
asm volatile ( "push r0 \n\t" \
|
||||
"in r0, __SREG__ \n\t" \
|
||||
"cli \n\t" \
|
||||
"push r0 \n\t" \
|
||||
"push r1 \n\t" \
|
||||
"clr r1 \n\t" \
|
||||
"push r2 \n\t" \
|
||||
"push r3 \n\t" \
|
||||
"push r4 \n\t" \
|
||||
"push r5 \n\t" \
|
||||
"push r6 \n\t" \
|
||||
"push r7 \n\t" \
|
||||
"push r8 \n\t" \
|
||||
"push r9 \n\t" \
|
||||
"push r10 \n\t" \
|
||||
"push r11 \n\t" \
|
||||
"push r12 \n\t" \
|
||||
"push r13 \n\t" \
|
||||
"push r14 \n\t" \
|
||||
"push r15 \n\t" \
|
||||
"push r16 \n\t" \
|
||||
"push r17 \n\t" \
|
||||
"push r18 \n\t" \
|
||||
"push r19 \n\t" \
|
||||
"push r20 \n\t" \
|
||||
"push r21 \n\t" \
|
||||
"push r22 \n\t" \
|
||||
"push r23 \n\t" \
|
||||
"push r24 \n\t" \
|
||||
"push r25 \n\t" \
|
||||
"push r26 \n\t" \
|
||||
"push r27 \n\t" \
|
||||
"push r28 \n\t" \
|
||||
"push r29 \n\t" \
|
||||
"push r30 \n\t" \
|
||||
"push r31 \n\t" \
|
||||
"lds r26, pxCurrentTCB \n\t" \
|
||||
"lds r27, pxCurrentTCB + 1 \n\t" \
|
||||
"in r0, 0x3d \n\t" \
|
||||
"st x+, r0 \n\t" \
|
||||
"in r0, 0x3e \n\t" \
|
||||
"st x+, r0 \n\t" \
|
||||
);
|
||||
|
||||
/*
|
||||
* Opposite to portSAVE_CONTEXT(). Interrupts will have been disabled during
|
||||
* the context save so we can write to the stack pointer.
|
||||
*/
|
||||
|
||||
#define portRESTORE_CONTEXT() \
|
||||
asm volatile ( "lds r26, pxCurrentTCB \n\t" \
|
||||
"lds r27, pxCurrentTCB + 1 \n\t" \
|
||||
"ld r28, x+ \n\t" \
|
||||
"out __SP_L__, r28 \n\t" \
|
||||
"ld r29, x+ \n\t" \
|
||||
"out __SP_H__, r29 \n\t" \
|
||||
"pop r31 \n\t" \
|
||||
"pop r30 \n\t" \
|
||||
"pop r29 \n\t" \
|
||||
"pop r28 \n\t" \
|
||||
"pop r27 \n\t" \
|
||||
"pop r26 \n\t" \
|
||||
"pop r25 \n\t" \
|
||||
"pop r24 \n\t" \
|
||||
"pop r23 \n\t" \
|
||||
"pop r22 \n\t" \
|
||||
"pop r21 \n\t" \
|
||||
"pop r20 \n\t" \
|
||||
"pop r19 \n\t" \
|
||||
"pop r18 \n\t" \
|
||||
"pop r17 \n\t" \
|
||||
"pop r16 \n\t" \
|
||||
"pop r15 \n\t" \
|
||||
"pop r14 \n\t" \
|
||||
"pop r13 \n\t" \
|
||||
"pop r12 \n\t" \
|
||||
"pop r11 \n\t" \
|
||||
"pop r10 \n\t" \
|
||||
"pop r9 \n\t" \
|
||||
"pop r8 \n\t" \
|
||||
"pop r7 \n\t" \
|
||||
"pop r6 \n\t" \
|
||||
"pop r5 \n\t" \
|
||||
"pop r4 \n\t" \
|
||||
"pop r3 \n\t" \
|
||||
"pop r2 \n\t" \
|
||||
"pop r1 \n\t" \
|
||||
"pop r0 \n\t" \
|
||||
"out __SREG__, r0 \n\t" \
|
||||
"pop r0 \n\t" \
|
||||
);
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/*
|
||||
* Perform hardware setup to enable ticks from timer 1, compare match A.
|
||||
*/
|
||||
static void prvSetupTimerInterrupt( void );
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/*
|
||||
* See header file for description.
|
||||
*/
|
||||
StackType_t *pxPortInitialiseStack( StackType_t *pxTopOfStack, TaskFunction_t pxCode, void *pvParameters )
|
||||
{
|
||||
uint16_t usAddress;
|
||||
|
||||
/* Place a few bytes of known values on the bottom of the stack.
|
||||
This is just useful for debugging. */
|
||||
|
||||
*pxTopOfStack = 0x11;
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = 0x22;
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = 0x33;
|
||||
pxTopOfStack--;
|
||||
|
||||
/* Simulate how the stack would look after a call to vPortYield() generated by
|
||||
the compiler. */
|
||||
|
||||
/*lint -e950 -e611 -e923 Lint doesn't like this much - but nothing I can do about it. */
|
||||
|
||||
/* The start of the task code will be popped off the stack last, so place
|
||||
it on first. */
|
||||
usAddress = ( uint16_t ) pxCode;
|
||||
*pxTopOfStack = ( StackType_t ) ( usAddress & ( uint16_t ) 0x00ff );
|
||||
pxTopOfStack--;
|
||||
|
||||
usAddress >>= 8;
|
||||
*pxTopOfStack = ( StackType_t ) ( usAddress & ( uint16_t ) 0x00ff );
|
||||
pxTopOfStack--;
|
||||
|
||||
usAddress >>= 8;
|
||||
*pxTopOfStack = ( StackType_t ) ( usAddress & ( uint16_t ) 0x00ff );
|
||||
pxTopOfStack--;
|
||||
|
||||
/* Next simulate the stack as if after a call to portSAVE_CONTEXT().
|
||||
portSAVE_CONTEXT places the flags on the stack immediately after r0
|
||||
to ensure the interrupts get disabled as soon as possible, and so ensuring
|
||||
the stack use is minimal should a context switch interrupt occur. */
|
||||
*pxTopOfStack = ( StackType_t ) 0x00; /* R0 */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = portFLAGS_INT_ENABLED;
|
||||
pxTopOfStack--;
|
||||
|
||||
|
||||
/* Now the remaining registers. The compiler expects R1 to be 0. */
|
||||
*pxTopOfStack = ( StackType_t ) 0x00; /* R1 */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( StackType_t ) 0x02; /* R2 */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( StackType_t ) 0x03; /* R3 */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( StackType_t ) 0x04; /* R4 */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( StackType_t ) 0x05; /* R5 */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( StackType_t ) 0x06; /* R6 */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( StackType_t ) 0x07; /* R7 */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( StackType_t ) 0x08; /* R8 */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( StackType_t ) 0x09; /* R9 */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( StackType_t ) 0x10; /* R10 */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( StackType_t ) 0x11; /* R11 */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( StackType_t ) 0x12; /* R12 */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( StackType_t ) 0x13; /* R13 */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( StackType_t ) 0x14; /* R14 */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( StackType_t ) 0x15; /* R15 */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( StackType_t ) 0x16; /* R16 */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( StackType_t ) 0x17; /* R17 */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( StackType_t ) 0x18; /* R18 */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( StackType_t ) 0x19; /* R19 */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( StackType_t ) 0x20; /* R20 */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( StackType_t ) 0x21; /* R21 */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( StackType_t ) 0x22; /* R22 */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( StackType_t ) 0x23; /* R23 */
|
||||
pxTopOfStack--;
|
||||
|
||||
/* Place the parameter on the stack in the expected location. */
|
||||
usAddress = ( uint16_t ) pvParameters;
|
||||
*pxTopOfStack = ( StackType_t ) ( usAddress & ( uint16_t ) 0x00ff );
|
||||
pxTopOfStack--;
|
||||
|
||||
usAddress >>= 8;
|
||||
*pxTopOfStack = ( StackType_t ) ( usAddress & ( uint16_t ) 0x00ff );
|
||||
pxTopOfStack--;
|
||||
|
||||
*pxTopOfStack = ( StackType_t ) 0x26; /* R26 X */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( StackType_t ) 0x27; /* R27 */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( StackType_t ) 0x28; /* R28 Y */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( StackType_t ) 0x29; /* R29 */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( StackType_t ) 0x30; /* R30 Z */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( StackType_t ) 0x031; /* R31 */
|
||||
pxTopOfStack--;
|
||||
|
||||
/*lint +e950 +e611 +e923 */
|
||||
|
||||
return pxTopOfStack;
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
BaseType_t xPortStartScheduler( void )
|
||||
{
|
||||
/* Setup the hardware to generate the tick. */
|
||||
prvSetupTimerInterrupt();
|
||||
|
||||
/* Restore the context of the first task that is going to run. */
|
||||
portRESTORE_CONTEXT();
|
||||
|
||||
/* Simulate a function call end as generated by the compiler. We will now
|
||||
jump to the start of the task the context of which we have just restored. */
|
||||
asm volatile ( "ret" );
|
||||
|
||||
/* Should not get here. */
|
||||
return pdTRUE;
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
void vPortEndScheduler( void )
|
||||
{
|
||||
/* It is unlikely that the AVR port will get stopped. If required simply
|
||||
disable the tick interrupt here. */
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/*
|
||||
* Manual context switch. The first thing we do is save the registers so we
|
||||
* can use a naked attribute.
|
||||
*/
|
||||
void vPortYield( void ) __attribute__ ( ( naked ) );
|
||||
void vPortYield( void )
|
||||
{
|
||||
portSAVE_CONTEXT();
|
||||
vTaskSwitchContext();
|
||||
portRESTORE_CONTEXT();
|
||||
|
||||
asm volatile ( "ret" );
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/*
|
||||
* Context switch function used by the tick. This must be identical to
|
||||
* vPortYield() from the call to vTaskSwitchContext() onwards. The only
|
||||
* difference from vPortYield() is the tick count is incremented as the
|
||||
* call comes from the tick ISR.
|
||||
*/
|
||||
void vPortYieldFromTick( void ) __attribute__ ( ( naked ) );
|
||||
void vPortYieldFromTick( void )
|
||||
{
|
||||
portSAVE_CONTEXT();
|
||||
if( xTaskIncrementTick() != pdFALSE )
|
||||
{
|
||||
vTaskSwitchContext();
|
||||
}
|
||||
portRESTORE_CONTEXT();
|
||||
|
||||
asm volatile ( "ret" );
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/*
|
||||
* Setup timer 1 compare match A to generate a tick interrupt.
|
||||
*/
|
||||
static void prvSetupTimerInterrupt( void )
|
||||
{
|
||||
uint32_t ulCompareMatch;
|
||||
uint8_t ucHighByte, ucLowByte;
|
||||
|
||||
/* Using 16bit timer 1 to generate the tick. Correct fuses must be
|
||||
selected for the configCPU_CLOCK_HZ clock. */
|
||||
|
||||
ulCompareMatch = configCPU_CLOCK_HZ / configTICK_RATE_HZ;
|
||||
|
||||
/* We only have 16 bits so have to scale to get our required tick rate. */
|
||||
ulCompareMatch /= portCLOCK_PRESCALER;
|
||||
|
||||
/* Adjust for correct value. */
|
||||
ulCompareMatch -= ( uint32_t ) 1;
|
||||
|
||||
/* Setup compare match value for compare match A. Interrupts are disabled
|
||||
before this is called so we need not worry here. */
|
||||
ucLowByte = ( uint8_t ) ( ulCompareMatch & ( uint32_t ) 0xff );
|
||||
ulCompareMatch >>= 8;
|
||||
ucHighByte = ( uint8_t ) ( ulCompareMatch & ( uint32_t ) 0xff );
|
||||
OCR1AH = ucHighByte;
|
||||
OCR1AL = ucLowByte;
|
||||
|
||||
/* Setup clock source and compare match behaviour. */
|
||||
ucLowByte = portCLEAR_COUNTER_ON_MATCH | portPRESCALE_64;
|
||||
TCCR1B = ucLowByte;
|
||||
|
||||
/* Enable the interrupt - this is okay as interrupt are currently globally
|
||||
disabled. */
|
||||
ucLowByte = TIMSK1;
|
||||
ucLowByte |= portCOMPARE_MATCH_A_INTERRUPT_ENABLE;
|
||||
TIMSK1 = ucLowByte;
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
#if configUSE_PREEMPTION == 1
|
||||
|
||||
/*
|
||||
* Tick ISR for preemptive scheduler. We can use a naked attribute as
|
||||
* the context is saved at the start of vPortYieldFromTick(). The tick
|
||||
* count is incremented after the context is saved.
|
||||
*/
|
||||
ISR ( TIMER1_COMPA_vect , ISR_NAKED )
|
||||
{
|
||||
vPortYieldFromTick();
|
||||
asm volatile ( "reti" );
|
||||
}
|
||||
#else
|
||||
|
||||
/*
|
||||
* Tick ISR for the cooperative scheduler. All this does is increment the
|
||||
* tick count. We don't need to switch context, this can only be done by
|
||||
* manual calls to taskYIELD();
|
||||
*/
|
||||
ISR ( TIMER1_COMPA_vect , ISR_NAKED )
|
||||
{
|
||||
xTaskIncrementTick();
|
||||
}
|
||||
#endif
|
26
arduino/principal.c
Normal file
26
arduino/principal.c
Normal file
|
@ -0,0 +1,26 @@
|
|||
#include <FreeRTOS.h>
|
||||
#include <task.h>
|
||||
#include <avr/io.h>
|
||||
|
||||
void TaskBlink(void *pvParameters)
|
||||
{
|
||||
(void) pvParameters;
|
||||
TickType_t xLastWakeTime;
|
||||
const TickType_t xFrequency = 200 / portTICK_PERIOD_MS;
|
||||
|
||||
DDRB = 0xFF;
|
||||
|
||||
xLastWakeTime = xTaskGetTickCount();
|
||||
for (;;)
|
||||
{
|
||||
PORTB = PINB ^ 0xFF;
|
||||
vTaskDelayUntil(&xLastWakeTime, xFrequency);
|
||||
}
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
xTaskCreate(TaskBlink, "Blink", 128, NULL, 2, NULL);
|
||||
vTaskStartScheduler();
|
||||
return 0;
|
||||
}
|
58
chef/Makefile
Normal file
58
chef/Makefile
Normal file
|
@ -0,0 +1,58 @@
|
|||
# VARIABLES
|
||||
|
||||
## Compilateur
|
||||
CC=gcc
|
||||
# Bibliothèques
|
||||
LIBS=
|
||||
## Drapeaux pour le linker
|
||||
LDFLAGS=
|
||||
## Drapeaux pour le compilateur
|
||||
CFLAGS=
|
||||
## Générateurs de drapeaux pour les bibliothèques
|
||||
PKG_CONFIG=pkg-config
|
||||
|
||||
# VARIABLES AUTOMATIQUES
|
||||
ifdef LIBS
|
||||
LDFLAGS += $(shell $(PKG_CONFIG) --libs $(LIBS))
|
||||
CFLAGS += $(shell $(PKG_CONFIG) --cflags $(LIBS))
|
||||
endif
|
||||
|
||||
# Par défaut on affiche les warnings et on ajoute les symboles de debug pour utiliser GDB
|
||||
CFLAGS += -Wall -Wextra -pedantic -g -DDEBUG
|
||||
# buildroot se charge de remplacer ces flags avec des optimisations
|
||||
|
||||
# RÈGLES AUTOMATIQUES DE COMPILATION
|
||||
|
||||
# Génération des fichiers éxecutables
|
||||
bin/%: obj/%.o
|
||||
$(CC) $(LDFLAGS) $^ -o $@
|
||||
# On enlève les symboles inutiles pour gagner en temps de chargement de l'éxecutable
|
||||
ifeq ($(DEBUG),no)
|
||||
strip $@
|
||||
endif
|
||||
|
||||
# RÈGLES DE COMPILATION
|
||||
|
||||
# Règle éxecutée par défaut (quand on fait juste `make`)
|
||||
default: bin/testpin bin/premier
|
||||
|
||||
# Binaires (dont il faut spécifier les objets explicitement)
|
||||
bin/premier: obj/common.o
|
||||
bin/testPin: obj/testPin.o
|
||||
$(CC) $(LDFLAGS) $^ -lwiringPi -o $@
|
||||
|
||||
# Génération des fichiers objets
|
||||
obj/%.o: src/%.c src/%.h
|
||||
$(CC) $(CFLAGS) -c $< -o $@
|
||||
obj/%.o: src/%.c
|
||||
$(CC) $(CFLAGS) -c $< -o $@
|
||||
|
||||
# OUTILS DE DÉVELOPPEMENT
|
||||
|
||||
# Supprime les fichiers automatiquement générés
|
||||
clean:
|
||||
rm -f obj/*
|
||||
rm -f bin/*
|
||||
|
||||
# Au cas où des fichiers avec certains noms existent, les règles suivantes seront executées quand même
|
||||
.PHONY: default clean
|
2
chef/bin/.gitignore
vendored
Normal file
2
chef/bin/.gitignore
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
*
|
||||
!.gitignore
|
2
chef/com/.gitignore
vendored
Normal file
2
chef/com/.gitignore
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
*
|
||||
!.gitignore
|
2
chef/obj/.gitignore
vendored
Normal file
2
chef/obj/.gitignore
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
*
|
||||
!.gitignore
|
9
chef/run.sh
Normal file
9
chef/run.sh
Normal file
|
@ -0,0 +1,9 @@
|
|||
#!/bin/sh
|
||||
|
||||
EXEC=bin/premier
|
||||
LOGFILE="${2:=run.log}"
|
||||
|
||||
# Logging
|
||||
"$EXEC" 2>&1 | while read line; do
|
||||
echo "$(cat /proc/uptime | cut -d ' ' -f 1) $line" >> "$LOGFILE"
|
||||
done
|
1
chef/src/common.c
Normal file
1
chef/src/common.c
Normal file
|
@ -0,0 +1 @@
|
|||
#include "common.h"
|
10
chef/src/common.h
Normal file
10
chef/src/common.h
Normal file
|
@ -0,0 +1,10 @@
|
|||
#ifndef __COMMON_H_
|
||||
#define __COMMON_H_
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#define SIGNAL_AVANCER 42
|
||||
|
||||
#endif
|
||||
|
7
chef/src/premier.c
Normal file
7
chef/src/premier.c
Normal file
|
@ -0,0 +1,7 @@
|
|||
#include "premier.h"
|
||||
|
||||
int main() {
|
||||
printf("Hello world!\n");
|
||||
// avancer(10);
|
||||
return 0;
|
||||
}
|
5
chef/src/premier.h
Normal file
5
chef/src/premier.h
Normal file
|
@ -0,0 +1,5 @@
|
|||
#ifndef __PREMIER_H_
|
||||
|
||||
#include "common.h"
|
||||
|
||||
#endif
|
32
chef/src/testpin.c
Normal file
32
chef/src/testpin.c
Normal file
|
@ -0,0 +1,32 @@
|
|||
/* Teste si une broche est connecté à une autre */
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <wiringPi.h>
|
||||
|
||||
char testPin(char input, char output) {
|
||||
pinMode(output, OUTPUT);
|
||||
pinMode(input, INPUT);
|
||||
digitalWrite(output, 1);
|
||||
delay(0);
|
||||
return digitalRead(input);
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
|
||||
if (argc != 3) {
|
||||
printf("Usage: %s INPUT_PIN OUTPUT_PIN\n", argv[0]);
|
||||
return 2;
|
||||
}
|
||||
|
||||
if (wiringPiSetup() == -1) {
|
||||
return 3;
|
||||
}
|
||||
|
||||
char input = atoi(argv[1]);
|
||||
char output = atoi(argv[2]);
|
||||
|
||||
char rep = testPin(input, output);
|
||||
|
||||
return rep;
|
||||
}
|
0
chef/src/testpin.h
Normal file
0
chef/src/testpin.h
Normal file
1
fpga/.gitignore
vendored
Normal file
1
fpga/.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
build/*
|
195
fpga/Makefile
Normal file
195
fpga/Makefile
Normal file
|
@ -0,0 +1,195 @@
|
|||
# From https://github.com/duskwuff/Xilinx-ISE-Makefile
|
||||
###########################################################################
|
||||
## Xilinx ISE Makefile
|
||||
##
|
||||
## To the extent possible under law, the author(s) have dedicated all copyright
|
||||
## and related and neighboring rights to this software to the public domain
|
||||
## worldwide. This software is distributed without any warranty.
|
||||
###########################################################################
|
||||
|
||||
include project.cfg
|
||||
|
||||
|
||||
###########################################################################
|
||||
# Default values
|
||||
###########################################################################
|
||||
|
||||
ifndef XILINX
|
||||
$(error XILINX must be defined)
|
||||
endif
|
||||
|
||||
ifndef PROJECT
|
||||
$(error PROJECT must be defined)
|
||||
endif
|
||||
|
||||
ifndef TARGET_PART
|
||||
$(error TARGET_PART must be defined)
|
||||
endif
|
||||
|
||||
TOPLEVEL ?= $(PROJECT)
|
||||
CONSTRAINTS ?= $(PROJECT).ucf
|
||||
BITFILE ?= build/$(PROJECT).bit
|
||||
|
||||
COMMON_OPTS ?= -intstyle xflow
|
||||
XST_OPTS ?=
|
||||
NGDBUILD_OPTS ?=
|
||||
MAP_OPTS ?=
|
||||
PAR_OPTS ?=
|
||||
BITGEN_OPTS ?=
|
||||
TRACE_OPTS ?=
|
||||
FUSE_OPTS ?= -incremental
|
||||
|
||||
PROGRAMMER ?= none
|
||||
|
||||
IMPACT_OPTS ?= -batch impact.cmd
|
||||
|
||||
DJTG_EXE ?= djtgcfg
|
||||
DJTG_DEVICE ?= DJTG_DEVICE-NOT-SET
|
||||
DJTG_INDEX ?= 0
|
||||
|
||||
XC3SPROG_EXE ?= xc3sprog
|
||||
XC3SPROG_CABLE ?= none
|
||||
XC3SPROG_OPTS ?=
|
||||
|
||||
MERCPCL_EXE ?= mercpcl
|
||||
|
||||
|
||||
###########################################################################
|
||||
# Internal variables, platform-specific definitions, and macros
|
||||
###########################################################################
|
||||
|
||||
ifeq ($(OS),Windows_NT)
|
||||
XILINX := $(shell cygpath -m $(XILINX))
|
||||
CYG_XILINX := $(shell cygpath $(XILINX))
|
||||
EXE := .exe
|
||||
XILINX_PLATFORM ?= nt64
|
||||
PATH := $(PATH):$(CYG_XILINX)/bin/$(XILINX_PLATFORM)
|
||||
else
|
||||
EXE :=
|
||||
XILINX_PLATFORM ?= lin64
|
||||
PATH := $(PATH):$(XILINX)/bin/$(XILINX_PLATFORM)
|
||||
endif
|
||||
|
||||
TEST_NAMES = $(foreach file,$(VTEST) $(VHDTEST),$(basename $(file)))
|
||||
TEST_EXES = $(foreach test,$(TEST_NAMES),build/isim_$(test)$(EXE))
|
||||
|
||||
RUN = @echo -ne "\n\n\e[1;33m======== $(1) ========\e[m\n\n"; \
|
||||
cd build && $(XILINX)/bin/$(XILINX_PLATFORM)/$(1)
|
||||
|
||||
# isim executables don't work without this
|
||||
export XILINX
|
||||
|
||||
|
||||
###########################################################################
|
||||
# Default build
|
||||
###########################################################################
|
||||
|
||||
default: $(BITFILE)
|
||||
|
||||
clean:
|
||||
rm -rf build
|
||||
|
||||
build/$(PROJECT).prj: project.cfg
|
||||
@echo "Updating $@"
|
||||
@mkdir -p build
|
||||
@rm -f $@
|
||||
@$(foreach file,$(VSOURCE),echo "verilog work \"../$(file)\"" >> $@;)
|
||||
@$(foreach file,$(VHDSOURCE),echo "vhdl work \"../$(file)\"" >> $@;)
|
||||
|
||||
build/$(PROJECT)_sim.prj: build/$(PROJECT).prj
|
||||
@cp build/$(PROJECT).prj $@
|
||||
@$(foreach file,$(VTEST),echo "verilog work \"../$(file)\"" >> $@;)
|
||||
@$(foreach file,$(VHDTEST),echo "vhdl work \"../$(file)\"" >> $@;)
|
||||
@echo "verilog work $(XILINX)/verilog/src/glbl.v" >> $@
|
||||
|
||||
build/$(PROJECT).scr: project.cfg
|
||||
@echo "Updating $@"
|
||||
@mkdir -p build
|
||||
@rm -f $@
|
||||
@echo "run" \
|
||||
"-ifn $(PROJECT).prj" \
|
||||
"-ofn $(PROJECT).ngc" \
|
||||
"-ifmt mixed" \
|
||||
"$(XST_OPTS)" \
|
||||
"-top $(TOPLEVEL)" \
|
||||
"-ofmt NGC" \
|
||||
"-p $(TARGET_PART)" \
|
||||
> build/$(PROJECT).scr
|
||||
|
||||
$(BITFILE): project.cfg $(VSOURCE) $(VHDSOURCE) $(CONSTRAINTS) build/$(PROJECT).prj build/$(PROJECT).scr
|
||||
@mkdir -p build
|
||||
$(call RUN,xst) $(COMMON_OPTS) \
|
||||
-ifn $(PROJECT).scr
|
||||
$(call RUN,ngdbuild) $(COMMON_OPTS) $(NGDBUILD_OPTS) \
|
||||
-p $(TARGET_PART) $(addprefix -uc ../,$(CONSTRAINTS)) \
|
||||
$(PROJECT).ngc $(PROJECT).ngd
|
||||
$(call RUN,map) $(COMMON_OPTS) $(MAP_OPTS) \
|
||||
-p $(TARGET_PART) \
|
||||
-w $(PROJECT).ngd -o $(PROJECT).map.ncd $(PROJECT).pcf
|
||||
$(call RUN,par) $(COMMON_OPTS) $(PAR_OPTS) \
|
||||
-w $(PROJECT).map.ncd $(PROJECT).ncd $(PROJECT).pcf
|
||||
$(call RUN,bitgen) $(COMMON_OPTS) $(BITGEN_OPTS) \
|
||||
-w $(PROJECT).ncd $(PROJECT).bit
|
||||
@echo -ne "\e[1;32m======== OK ========\e[m\n"
|
||||
|
||||
|
||||
###########################################################################
|
||||
# Testing (work in progress)
|
||||
###########################################################################
|
||||
|
||||
trace: project.cfg $(BITFILE)
|
||||
$(call RUN,trce) $(COMMON_OPTS) $(TRACE_OPTS) \
|
||||
$(PROJECT).ncd $(PROJECT).pcf
|
||||
|
||||
test: $(TEST_EXES)
|
||||
|
||||
build/isim_%$(EXE): build/$(PROJECT)_sim.prj $(VSOURCE) $(VHDSOURCE) $(VTEST) $(VHDTEST)
|
||||
$(call RUN,fuse) $(COMMON_OPTS) $(FUSE_OPTS) \
|
||||
-prj $(PROJECT)_sim.prj \
|
||||
-o isim_$*$(EXE) \
|
||||
work.$* work.glbl
|
||||
|
||||
isim: build/isim_$(TB)$(EXE)
|
||||
@grep --no-filename --no-messages 'ISIM:' $(TB).{v,vhd} | cut -d: -f2 > build/isim_$(TB).cmd
|
||||
@echo "run all" >> build/isim_$(TB).cmd
|
||||
cd build ; ./isim_$(TB)$(EXE) -tclbatch isim_$(TB).cmd
|
||||
|
||||
isimgui: build/isim_$(TB)$(EXE)
|
||||
@grep --no-filename --no-messages 'ISIM:' $(TB).{v,vhd} | cut -d: -f2 > build/isim_$(TB).cmd
|
||||
@echo "run all" >> build/isim_$(TB).cmd
|
||||
cd build ; ./isim_$(TB)$(EXE) -gui -tclbatch isim_$(TB).cmd
|
||||
|
||||
|
||||
###########################################################################
|
||||
# Programming
|
||||
###########################################################################
|
||||
|
||||
ifeq ($(PROGRAMMER), impact)
|
||||
prog: $(BITFILE)
|
||||
$(XILINX)/bin/$(XILINX_PLATFORM)/impact $(IMPACT_OPTS)
|
||||
endif
|
||||
|
||||
ifeq ($(PROGRAMMER), digilent)
|
||||
prog: $(BITFILE)
|
||||
$(DJTG_EXE) prog -d $(DJTG_DEVICE) -i $(DJTG_INDEX) -f $(BITFILE)
|
||||
endif
|
||||
|
||||
ifeq ($(PROGRAMMER), xc3sprog)
|
||||
prog: $(BITFILE)
|
||||
$(XC3SPROG_EXE) -c $(XC3SPROG_CABLE) $(XC3SPROG_OPTS) $(BITFILE)
|
||||
endif
|
||||
|
||||
ifeq ($(PROGRAMMER), mercpcl)
|
||||
prog: $(BITFILE)
|
||||
$(MERCPCL_EXE) $(BITFILE)
|
||||
endif
|
||||
|
||||
ifeq ($(PROGRAMMER), none)
|
||||
prog:
|
||||
$(error PROGRAMMER must be set to use 'make prog')
|
||||
endif
|
||||
|
||||
|
||||
###########################################################################
|
||||
|
||||
# vim: set filetype=make: #
|
29
fpga/Principal.vhd
Normal file
29
fpga/Principal.vhd
Normal file
|
@ -0,0 +1,29 @@
|
|||
library IEEE;
|
||||
use IEEE.STD_LOGIC_1164.ALL;
|
||||
|
||||
|
||||
entity Principal is
|
||||
Port ( CLK : in STD_LOGIC;
|
||||
LED : out STD_LOGIC_VECTOR (3 downto 0));
|
||||
end Principal;
|
||||
|
||||
architecture Behavioral of Principal is
|
||||
signal pulse : std_logic := '0';
|
||||
signal count : integer range 0 to 49999999 := 0;
|
||||
begin
|
||||
|
||||
counter : process(CLK)
|
||||
begin
|
||||
if CLK'event and CLK = '1' then
|
||||
if count = 49999999 then
|
||||
count <= 0;
|
||||
pulse <= not pulse;
|
||||
else
|
||||
count <= count + 1;
|
||||
end if;
|
||||
end if;
|
||||
end process;
|
||||
|
||||
LED(3 downto 0) <= (others => pulse);
|
||||
end Behavioral;
|
||||
|
3
fpga/README.md
Normal file
3
fpga/README.md
Normal file
|
@ -0,0 +1,3 @@
|
|||
# Programme pour le FPGA
|
||||
|
||||
Convention : les fichiers .vhd commençant par une minuscule sont des modules, ceux commençant par une majuscule peuvent être utilisés en top-level.
|
89
fpga/hcSr04.vhd
Normal file
89
fpga/hcSr04.vhd
Normal file
|
@ -0,0 +1,89 @@
|
|||
LIBRARY ieee;
|
||||
USE ieee.std_logic_1164.all;
|
||||
USE ieee.std_logic_unsigned.all;
|
||||
|
||||
ENTITY hcSr04 IS
|
||||
GENERIC(
|
||||
fFpga : INTEGER := 50_000_000 -- frequency of the FPGA clock (Hz)
|
||||
);
|
||||
PORT(
|
||||
clk : IN STD_LOGIC; -- clock of the FPGA
|
||||
echo : IN STD_LOGIC; -- echo pin of the hcSr04
|
||||
distance : OUT INTEGER RANGE 0 TO 65535; -- Divide by 58 to get the value in cm
|
||||
trigger : OUT STD_LOGIC; -- trigger pin of the hcSr04
|
||||
start : IN STD_LOGIC; -- Set to '1' everytime a measurement is needed (or keep at '1' for continuous measurement)
|
||||
finished : OUT STD_LOGIC -- Driven to '1' everytime a measurement has finished
|
||||
);
|
||||
END hcSr04;
|
||||
|
||||
ARCHITECTURE Behavioral OF hcSr04 IS
|
||||
-- Generate us clock
|
||||
CONSTANT fUs : INTEGER := 1_000_000; -- Frequency of the microsecond clock
|
||||
CONSTANT usTicks : INTEGER := fFPGA / fUs; -- Number of FPGA tick that makes a microsecond
|
||||
SIGNAL fpgaCounter : INTEGER RANGE 0 TO usTicks - 1; -- Count the microsecond
|
||||
SIGNAL usClk : STD_LOGIC; -- Clock that ticks every us
|
||||
|
||||
-- Trigger
|
||||
CONSTANT triggerDuration : INTEGER := 10; -- Number of us that makes up a trigger sequence
|
||||
SIGNAL triggerCounter : INTEGER RANGE 0 TO triggerDuration - 1 := 0; -- Progress in the trigger sequence
|
||||
SIGNAL theTrigger : STD_LOGIC := '0'; -- Trigger pin but with default value
|
||||
|
||||
-- Measurement
|
||||
CONSTANT measurementDuration : INTEGER := 60_000; -- Number of us that makes up a measurement cycle
|
||||
SIGNAL measurementCounter : INTEGER RANGE 0 TO measurementDuration - 1 := 0; -- Progress in the measurement cycle
|
||||
|
||||
-- Distance
|
||||
SIGNAL distanceCounter : INTEGER RANGE 0 TO 65535 := 0; -- Distance measured (in us)
|
||||
|
||||
-- State machine
|
||||
TYPE stateType IS (waiting, triggering, measuring);
|
||||
SIGNAL state : stateType;
|
||||
|
||||
BEGIN
|
||||
us : process(clk)
|
||||
begin
|
||||
if rising_edge(clk) then
|
||||
if fpgaCounter = 0 then
|
||||
usClk <= '0';
|
||||
elsif fpgaCounter = 1 then
|
||||
usClk <= '1';
|
||||
end if;
|
||||
fpgaCounter <= fpgaCounter + 1;
|
||||
end if;
|
||||
end process;
|
||||
|
||||
trigger <= theTrigger;
|
||||
|
||||
measure : process(usClk)
|
||||
begin
|
||||
if rising_edge(usClk) then
|
||||
CASE state IS
|
||||
WHEN waiting =>
|
||||
finished <= '0';
|
||||
IF start = '1' THEN
|
||||
theTrigger <= '1';
|
||||
triggerCounter <= 0;
|
||||
state <= triggering;
|
||||
END IF;
|
||||
WHEN triggering =>
|
||||
triggerCounter <= triggerCounter + 1;
|
||||
IF triggerCounter = triggerDuration - 1 THEN
|
||||
theTrigger <= '0';
|
||||
measurementCounter <= 0;
|
||||
distanceCounter <= 0;
|
||||
state <= measuring;
|
||||
END IF;
|
||||
WHEN measuring =>
|
||||
IF echo = '1' and distanceCounter < 65535 THEN
|
||||
distanceCounter <= distanceCounter + 1;
|
||||
END IF;
|
||||
measurementCounter <= measurementCounter + 1;
|
||||
IF measurementCounter = measurementDuration - 1 THEN
|
||||
distance <= distanceCounter;
|
||||
finished <= '1';
|
||||
state <= waiting;
|
||||
END IF;
|
||||
END CASE;
|
||||
end if;
|
||||
end process;
|
||||
END Behavioral;
|
69
fpga/hcSr04Fulldiv.vhd
Normal file
69
fpga/hcSr04Fulldiv.vhd
Normal file
|
@ -0,0 +1,69 @@
|
|||
LIBRARY ieee;
|
||||
USE ieee.std_logic_1164.all;
|
||||
USE ieee.std_logic_unsigned.all;
|
||||
USE ieee.std_logic_arith.all;
|
||||
|
||||
ENTITY hcSr04 IS
|
||||
GENERIC(
|
||||
fFpga : INTEGER := 50_000_000; -- frequency of the FPGA clock (Hz)
|
||||
maxOutput : INTEGER := 65535 -- maximum number to store the distance
|
||||
);
|
||||
PORT(
|
||||
clk : IN STD_LOGIC; -- clock of the FPGA
|
||||
echo : IN STD_LOGIC; -- echo pin of the hcSr04
|
||||
distance : OUT INTEGER RANGE 0 TO maxOutput; -- Ranges from 0 to 4 meters, 0 if no data
|
||||
trigger : OUT STD_LOGIC; -- trigger pin of the hcSr04
|
||||
start : IN STD_LOGIC; -- Set to '1' everytime a measurement is needed (or keep at '1' for continuous measurement)
|
||||
finished : OUT STD_LOGIC -- Driven to '1' everytime a measurement has finished
|
||||
);
|
||||
END hcSr04;
|
||||
|
||||
ARCHITECTURE Behavioral OF hcSr04 IS
|
||||
CONSTANT triggerTicks : INTEGER := fFPGA / 100000; -- Number of FPGA ticks that makes 10us (used for trigger)
|
||||
CONSTANT measurementTicks : INTEGER := fFPGA / 17; -- Number of FPGA ticks that makes 60ms (used for measurement cycles)
|
||||
CONSTANT maximumRange : INTEGER := 4; -- Maximum range the sensor can detect
|
||||
CONSTANT distanceTicks : INTEGER := maximumRange * fFPGA / 172; -- Number of FPGA ticks that makes the maximum distance that can be measured
|
||||
-- 172 = 1 / 58 s/m
|
||||
SIGNAL measurementCounter : INTEGER RANGE 0 to measurementTicks - 1 := 0; -- Progress in the measurement
|
||||
SIGNAL distanceCounter : INTEGER RANGE 0 to distanceTicks - 1 := 0; -- Ticks for wich echo has been at one
|
||||
SIGNAL triggerCounter : INTEGER RANGE 0 to triggerTicks - 1 := 0; -- Progress in the trigger
|
||||
TYPE stateType IS (init, waiting, triggering, measuring);
|
||||
SIGNAL state : stateType;
|
||||
BEGIN
|
||||
measure : process(clk)
|
||||
begin
|
||||
if rising_edge(clk) then
|
||||
CASE state IS
|
||||
WHEN init =>
|
||||
trigger <= '0';
|
||||
distance <= 0;
|
||||
state <= waiting;
|
||||
WHEN waiting =>
|
||||
finished <= '0';
|
||||
IF start = '1' THEN
|
||||
trigger <= '1';
|
||||
triggerCounter <= 0;
|
||||
state <= triggering;
|
||||
END IF;
|
||||
WHEN triggering =>
|
||||
triggerCounter <= triggerCounter + 1;
|
||||
IF triggerCounter = triggerTicks - 1 THEN
|
||||
trigger <= '0';
|
||||
measurementCounter <= 0;
|
||||
distanceCounter <= 0;
|
||||
state <= measuring;
|
||||
END IF;
|
||||
WHEN measuring =>
|
||||
IF echo = '1' and distanceCounter < distanceTicks THEN
|
||||
distanceCounter <= distanceCounter + 1;
|
||||
END IF;
|
||||
measurementCounter <= measurementCounter + 1;
|
||||
IF measurementCounter = measurementTicks - 1 THEN
|
||||
distance <= distanceCounter * maxOutput / distanceTicks;
|
||||
finished <= '1';
|
||||
state <= waiting;
|
||||
END IF;
|
||||
END CASE;
|
||||
end if;
|
||||
end process;
|
||||
END Behavioral;
|
70
fpga/hedm.vhd
Normal file
70
fpga/hedm.vhd
Normal file
|
@ -0,0 +1,70 @@
|
|||
-- Process signals from HEDM-550X encoder
|
||||
-- and output the value read
|
||||
|
||||
-- TODO Quelques modifications apportées depuis test avec les vraies codeuses
|
||||
-- un nouveau test sera nécessaire (vérifier notamment le sens de parcours)
|
||||
|
||||
library IEEE;
|
||||
use IEEE.STD_LOGIC_1164.ALL;
|
||||
use ieee.numeric_std.all;
|
||||
|
||||
entity hedm is
|
||||
Port (
|
||||
clk : in STD_LOGIC; -- Horloge, la fréquence n'importe pas
|
||||
chA : in STD_LOGIC; -- Canal A
|
||||
chB : in STD_LOGIC; -- Canal B
|
||||
counts : out -- Integer;
|
||||
);
|
||||
end hedm;
|
||||
|
||||
architecture Behavioral of hedm is
|
||||
signal counter : integer;
|
||||
signal An, Bn : STD_LOGIC; -- Nouvelles valeurs de A et B stockées pour que les entrées soient lues une seule fois en début de cycle
|
||||
signal Ap, Bp : STD_LOGIC; -- Précédentes valeurs de A et B pour détecter les front montant
|
||||
begin
|
||||
processInput : process(clk)
|
||||
begin
|
||||
if rising_edge(clk) then
|
||||
|
||||
Ap <= An;
|
||||
Bp <= Bn;
|
||||
|
||||
An <= A;
|
||||
Bn <= B;
|
||||
|
||||
-- On pourrait optimiser la logique avec un tableau de Karnaugh ou autres méthodes
|
||||
-- de simplification d'algèbre de Boole, mais le "compilateur" pour FPGA fera un
|
||||
-- tout aussi bon travail, on garde donc le code suivant pour la lisibilité
|
||||
|
||||
if (Ap = '0' and An = '1') then -- Front montant A
|
||||
if (Bn = '0') then
|
||||
counter <= counter + 1;
|
||||
else
|
||||
counter <= counter - 1;
|
||||
end if;
|
||||
elsif (Ap = '1' and An = '0') then -- Front descendant A
|
||||
if (Bn = '1') then
|
||||
counter <= counter + 1;
|
||||
else
|
||||
counter <= counter - 1;
|
||||
end if;
|
||||
elsif (Bp = '0' and Bn = '1') then -- Front montant B
|
||||
if (An = '1') then
|
||||
counter <= counter + 1;
|
||||
else
|
||||
counter <= counter - 1;
|
||||
end if;
|
||||
elsif (Bp = '1' and Bn = '0') then -- Front descendant B
|
||||
if (An = '0') then
|
||||
counter <= counter + 1;
|
||||
else
|
||||
counter <= counter - 1;
|
||||
end if;
|
||||
end if;
|
||||
end if;
|
||||
end process;
|
||||
|
||||
counts <= counter;
|
||||
|
||||
end Behavioral;
|
||||
|
90
fpga/mercury.ucf
Normal file
90
fpga/mercury.ucf
Normal file
|
@ -0,0 +1,90 @@
|
|||
# __ ____ _ __
|
||||
# / |/ (_)_____________ / | / /___ _ ______ _
|
||||
# / /|_/ / / ___/ ___/ __ \/ |/ / __ \ | / / __ `/
|
||||
# / / / / / /__/ / / /_/ / /| / /_/ / |/ / /_/ /
|
||||
# /_/ /_/_/\___/_/ \____/_/ |_/\____/|___/\__,_/
|
||||
#
|
||||
# Mercury User Constraints File
|
||||
# Revision 1.0.142 (10/24/2012)
|
||||
# Copyright (c) 2012 MicroNova, LLC
|
||||
# www.micro-nova.com
|
||||
|
||||
# system oscillator
|
||||
NET "CLK" LOC = "P43" | IOSTANDARD = LVTTL ;
|
||||
NET "CLK" TNM_NET = "CLK";
|
||||
TIMESPEC "TS_CLK" = PERIOD "CLK" 20 ns HIGH 50 %;
|
||||
|
||||
# user LEDs and button
|
||||
NET "LED<0>" LOC = "P13" | IOSTANDARD = LVTTL ;
|
||||
NET "LED<1>" LOC = "P15" | IOSTANDARD = LVTTL ;
|
||||
NET "LED<2>" LOC = "P16" | IOSTANDARD = LVTTL ;
|
||||
NET "LED<3>" LOC = "P19" | IOSTANDARD = LVTTL ;
|
||||
NET "BTN" LOC = "P41" | IOSTANDARD = LVTTL ;
|
||||
|
||||
# direct and global-clock I/O
|
||||
NET "DIO<0>" LOC = "P20" | IOSTANDARD = LVTTL ;
|
||||
NET "DIO<1>" LOC = "P32" | IOSTANDARD = LVTTL ;
|
||||
NET "DIO<2>" LOC = "P33" | IOSTANDARD = LVTTL ;
|
||||
NET "DIO<3>" LOC = "P34" | IOSTANDARD = LVTTL ;
|
||||
NET "DIO<4>" LOC = "P35" | IOSTANDARD = LVTTL ;
|
||||
NET "DIO<5>" LOC = "P36" | IOSTANDARD = LVTTL ;
|
||||
NET "DIO<6>" LOC = "P37" | IOSTANDARD = LVTTL ;
|
||||
NET "CIO<0>" LOC = "P40" | IOSTANDARD = LVTTL ;
|
||||
NET "CIO<1>" LOC = "P44" | IOSTANDARD = LVTTL ;
|
||||
|
||||
# in-only pins
|
||||
NET "INPIN<0>" LOC = "P68" | IOSTANDARD = LVTTL ;
|
||||
NET "INPIN<1>" LOC = "P97" | IOSTANDARD = LVTTL ;
|
||||
NET "INPIN<2>" LOC = "P7" | IOSTANDARD = LVTTL ;
|
||||
NET "INPIN<3>" LOC = "P82" | IOSTANDARD = LVTTL ;
|
||||
|
||||
# level-shifted I/O
|
||||
NET "IO<0>" LOC = "P59" | IOSTANDARD = LVTTL ;
|
||||
NET "IO<1>" LOC = "P60" | IOSTANDARD = LVTTL ;
|
||||
NET "IO<2>" LOC = "P61" | IOSTANDARD = LVTTL ;
|
||||
NET "IO<3>" LOC = "P62" | IOSTANDARD = LVTTL ;
|
||||
NET "IO<4>" LOC = "P64" | IOSTANDARD = LVTTL ;
|
||||
NET "IO<5>" LOC = "P57" | IOSTANDARD = LVTTL ;
|
||||
NET "IO<6>" LOC = "P56" | IOSTANDARD = LVTTL ;
|
||||
NET "IO<7>" LOC = "P52" | IOSTANDARD = LVTTL ;
|
||||
NET "IO<8>" LOC = "P50" | IOSTANDARD = LVTTL ;
|
||||
NET "IO<9>" LOC = "P49" | IOSTANDARD = LVTTL ;
|
||||
NET "IO<10>" LOC = "P85" | IOSTANDARD = LVTTL ;
|
||||
NET "IO<11>" LOC = "P84" | IOSTANDARD = LVTTL ;
|
||||
NET "IO<12>" LOC = "P83" | IOSTANDARD = LVTTL ;
|
||||
NET "IO<13>" LOC = "P78" | IOSTANDARD = LVTTL ;
|
||||
NET "IO<14>" LOC = "P77" | IOSTANDARD = LVTTL ;
|
||||
NET "IO<15>" LOC = "P65" | IOSTANDARD = LVTTL ;
|
||||
NET "IO<16>" LOC = "P70" | IOSTANDARD = LVTTL ;
|
||||
NET "IO<17>" LOC = "P71" | IOSTANDARD = LVTTL ;
|
||||
NET "IO<18>" LOC = "P72" | IOSTANDARD = LVTTL ;
|
||||
NET "IO<19>" LOC = "P73" | IOSTANDARD = LVTTL ;
|
||||
NET "IO<20>" LOC = "P5" | IOSTANDARD = LVTTL ;
|
||||
NET "IO<21>" LOC = "P4" | IOSTANDARD = LVTTL ;
|
||||
NET "IO<22>" LOC = "P6" | IOSTANDARD = LVTTL ;
|
||||
NET "IO<23>" LOC = "P98" | IOSTANDARD = LVTTL ;
|
||||
NET "IO<24>" LOC = "P94" | IOSTANDARD = LVTTL ;
|
||||
NET "IO<25>" LOC = "P93" | IOSTANDARD = LVTTL ;
|
||||
NET "IO<26>" LOC = "P90" | IOSTANDARD = LVTTL ;
|
||||
NET "IO<27>" LOC = "P89" | IOSTANDARD = LVTTL ;
|
||||
NET "IO<28>" LOC = "P88" | IOSTANDARD = LVTTL ;
|
||||
NET "IO<29>" LOC = "P86" | IOSTANDARD = LVTTL ;
|
||||
|
||||
# memory & bus-switch
|
||||
NET "switch_oen" LOC = "P3" | IOSTANDARD = LVTTL ;
|
||||
NET "memory_oen" LOC = "P30" | IOSTANDARD = LVTTL ;
|
||||
|
||||
# flash/usb interface
|
||||
NET "fpga_csn" LOC = "P39" | IOSTANDARD = LVTTL ;
|
||||
NET "flash_csn" LOC = "P27" | IOSTANDARD = LVTTL ;
|
||||
NET "spi_mosi" LOC = "P46" | IOSTANDARD = LVTTL ;
|
||||
NET "spi_miso" LOC = "P51" | IOSTANDARD = LVTTL ;
|
||||
NET "spi_sck" LOC = "P53" | IOSTANDARD = LVTTL ;
|
||||
|
||||
# ADC interface
|
||||
NET "adc_miso" LOC = "P21" | IOSTANDARD = LVTTL ;
|
||||
NET "adc_mosi" LOC = "P10" | IOSTANDARD = LVTTL ;
|
||||
NET "adc_sck" LOC = "P9" | IOSTANDARD = LVTTL ;
|
||||
NET "adc_csn" LOC = "P12" | IOSTANDARD = LVTTL ;
|
||||
|
||||
# CLOCK timing
|
14
fpga/project.cfg
Normal file
14
fpga/project.cfg
Normal file
|
@ -0,0 +1,14 @@
|
|||
PROJECT = Principal
|
||||
TARGET_PART = xc3s200a-vq100
|
||||
XILINX = /opt/Xilinx/14.7/ISE_DS/ISE
|
||||
PROGRAMMER = mercpcl
|
||||
|
||||
TOPLEVEL = Principal
|
||||
VHDSOURCE = $(TOPLEVEL).vhd
|
||||
CONSTRAINTS = mercury.ucf
|
||||
|
||||
# Implement design
|
||||
# Allow unmatched LOC Constraints
|
||||
NGDBUILD_OPTS += -aul
|
||||
# Allow unmatched Timing Group Constraints
|
||||
NGDBUILD_OPTS += -aut
|
1
fpga/uart
Submodule
1
fpga/uart
Submodule
|
@ -0,0 +1 @@
|
|||
Subproject commit ba6d1c3a7acbec274282c59af11dae64eaec2618
|
1
fpga/uart.vhd
Symbolic link
1
fpga/uart.vhd
Symbolic link
|
@ -0,0 +1 @@
|
|||
uart/source/uart.vhd
|
5
raspberrypi/.gitignore
vendored
Normal file
5
raspberrypi/.gitignore
vendored
Normal file
|
@ -0,0 +1,5 @@
|
|||
dl
|
||||
output
|
||||
principalconf.sh
|
||||
sshconf
|
||||
sshkey*
|
2
raspberrypi/Config.in
Normal file
2
raspberrypi/Config.in
Normal file
|
@ -0,0 +1,2 @@
|
|||
source "$BR2_EXTERNAL_CDF_PATH/package/robotech/Config.in"
|
||||
source "$BR2_EXTERNAL_CDF_PATH/package/cr1901/Config.in"
|
102
raspberrypi/Makefile
Normal file
102
raspberrypi/Makefile
Normal file
|
@ -0,0 +1,102 @@
|
|||
default: compile
|
||||
|
||||
upgrade-all: upgrade-chef upgrade-arduino upgrade-fpga upgrade-filesystem
|
||||
|
||||
# CONSTANTES
|
||||
|
||||
# Périphérique bloc à utiliser pour flasher
|
||||
SDCARD=/dev/mmcblk0
|
||||
|
||||
# SYSTÈME D'EXPLOITATION
|
||||
|
||||
# Configuration
|
||||
buildroot/.config: configs/cdfprincipal_defconfig
|
||||
make -C buildroot BR2_EXTERNAL=.. cdfprincipal_defconfig
|
||||
|
||||
configure: buildroot/.config
|
||||
|
||||
# Compile l'OS (ça prend quelques heures)
|
||||
compile: configure
|
||||
make -C buildroot target-finalize
|
||||
|
||||
# Crée l'image à flasher
|
||||
image:
|
||||
make -C buildroot
|
||||
|
||||
# Supprime tous les fichiers de l'OS
|
||||
clean:
|
||||
make -C buildroot clean
|
||||
|
||||
# Dernier recours en cas de compilation d'OS foireuse
|
||||
# (faut être patient)
|
||||
recompile: clean compile
|
||||
|
||||
# Flashe l'image sur la carte SD
|
||||
flash: image $(SDCARD)
|
||||
sudo dd status=progress if=buildroot/output/images/sdcard.img of=$(SDCARD) bs=1M
|
||||
sync
|
||||
echo -e "resizepart 2\n100%\nquit" | sudo parted $(SDCARD)
|
||||
sync
|
||||
sudo resize2fs $(SDCARD)*2
|
||||
sync
|
||||
|
||||
# Graphiques (parce que c'est rigolo)
|
||||
graphs:
|
||||
make -C buildroot graph-{size,build,depends{,-requirements}}
|
||||
|
||||
# CONNEXION AU ROBOT
|
||||
|
||||
# Il vous faudra pour ces actions le fichier principalconf.sh
|
||||
|
||||
# Crée un fichier de conf utilisable pour s'y connecter
|
||||
sshconf: principalconf.sh
|
||||
source $$PWD/$<; echo -e "Host principal p\n User root\n Hostname $$ADDRESS\n PreferredAuthentications publickey\n PubkeyAuthentication yes\n IdentityFile \"$$PWD/sshkey\"" > "$@"
|
||||
source $$PWD/$<; echo -e "$$SSHCPRV" > sshkey
|
||||
chmod 600 sshkey
|
||||
|
||||
# Lance une connexion SSH, tout bêtement
|
||||
ssh: sshconf
|
||||
ssh -F sshconf principal
|
||||
|
||||
# Redémarre le robot
|
||||
reboot: sshconf
|
||||
ssh -F sshconf principal /sbin/reboot
|
||||
|
||||
# Met le robot à l'heure (jusqu'au prochain redémarrage)
|
||||
# (ce qui est une mauvaise idée parce que du coup rsync
|
||||
# n'écrase pas les fichiers modifiés directement sur le Pi)
|
||||
#date: sshconf
|
||||
# ssh -F sshconf principal "date -s $(date +%Y%m%d%H%M.%S)"
|
||||
|
||||
# Met à jour le Raspberry Pi (par rapport à ce dépôt)
|
||||
upgrade-filesystem: sshconf configure
|
||||
make -C buildroot target-finalize
|
||||
@# TODO Récupérer les ACL plutot que de mettre tous les fichiers en root
|
||||
rsync --rsh 'ssh -F sshconf' --archive --chown root:root buildroot/output/target/ principal:/
|
||||
|
||||
# Met jour les overlays (une partie des fichiers)
|
||||
upgrade-overlays: sshconf
|
||||
rsync --rsh 'ssh -F sshconf' --archive --chown root:root robotech/chef/rootfs_overlay/ principal:/
|
||||
|
||||
# ARDUINO
|
||||
upgrade-arduino:
|
||||
make -C ../arduino/
|
||||
scp -F sshconf -q "../arduino/principal.hex" principal:/tmp/principal.hex
|
||||
ssh -F sshconf principal "avrdude -p atmega2560 -P /dev/ttyACM0 -c stk500 -D -U flash:w:/tmp/principal.hex"
|
||||
|
||||
# FPGA
|
||||
upgrade-fpga:
|
||||
make -C ../fpga/
|
||||
scp -F sshconf -q "../fpga/build/Principal.bit" principal:/tmp/Principal.bit
|
||||
ssh -F sshconf principal "mercpcl /tmp/Principal.bit"
|
||||
|
||||
# CHEF
|
||||
|
||||
prog: chef
|
||||
chef:
|
||||
make -C buildroot chef-rebuild
|
||||
|
||||
upgrade-chef: chef
|
||||
make -C buildroot chef-reinstall
|
||||
rsync --rsh 'ssh -F sshconf' --archive --chown root:root buildroot/output/target/opt/chef principal:/opt/
|
||||
|
2
raspberrypi/board/robotech/cdfprincipal/linux-extra.conf
Normal file
2
raspberrypi/board/robotech/cdfprincipal/linux-extra.conf
Normal file
|
@ -0,0 +1,2 @@
|
|||
MEDIA_SUPPORT=n
|
||||
SOUND=n
|
42
raspberrypi/board/robotech/cdfprincipal/post-build.sh
Executable file
42
raspberrypi/board/robotech/cdfprincipal/post-build.sh
Executable file
|
@ -0,0 +1,42 @@
|
|||
#!/bin/sh
|
||||
|
||||
if file ${BR2_EXTERNAL_CDF_PATH}/principalconf.sh &> /dev/null
|
||||
then
|
||||
source ${BR2_EXTERNAL_CDF_PATH}/principalconf.sh
|
||||
|
||||
# Wi-Fi configuration
|
||||
mkdir -p ${TARGET_DIR}/etc/wpa_supplicant/
|
||||
wpa_passphrase "$WPASSID" "$WPAPSK" > ${TARGET_DIR}/etc/wpa_supplicant/wpa_supplicant.conf
|
||||
# Le ifup de Busybox ne supporte pas les options wpa-*, donc on utilisera les wpa_supplicant en direct
|
||||
|
||||
# Network configuration
|
||||
echo -e "
|
||||
auto wlan0
|
||||
iface wlan0 inet static
|
||||
address $ADDRESS
|
||||
netmask $NETMASK
|
||||
gateway $GATEWAY
|
||||
" >> ${TARGET_DIR}/etc/network/interfaces
|
||||
|
||||
# SSH configuration
|
||||
rm ${TARGET_DIR}/etc/dropbear &> /dev/null
|
||||
mkdir -p ${TARGET_DIR}/etc/dropbear/
|
||||
echo "$SSHSPRV" | base64 -d > ${TARGET_DIR}/etc/dropbear/dropbear_ecdsa_host_key
|
||||
mkdir -p ${TARGET_DIR}/root/.ssh/
|
||||
echo "$SSHCPUB" > ${TARGET_DIR}/root/.ssh/authorized_keys
|
||||
else
|
||||
echo "Récupérez le fichier principalconf.sh pour pouvoir vous connecter au vrai robot !"
|
||||
fi
|
||||
|
||||
# Demote some services
|
||||
for service in S20urandom S40network S50dropbear
|
||||
do
|
||||
if [ -f ${TARGET_DIR}/etc/init.d/${service} ]
|
||||
then
|
||||
mv ${TARGET_DIR}/etc/init.d/${service} ${TARGET_DIR}/etc/extra.d/${service}
|
||||
fi
|
||||
|
||||
done
|
||||
|
||||
dd if=/dev/urandom of=${TARGET_DIR}/etc/random-seed bs=512 count=1
|
||||
|
41
raspberrypi/board/robotech/cdfprincipal/rootfs_overlay/etc/extra.d/S40wifi
Executable file
41
raspberrypi/board/robotech/cdfprincipal/rootfs_overlay/etc/extra.d/S40wifi
Executable file
|
@ -0,0 +1,41 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# Connect to Wi-Fi network
|
||||
#
|
||||
|
||||
start() {
|
||||
printf "Starting Wi-Fi connection: "
|
||||
# modprobe brcmfmac
|
||||
modprobe r8188eu
|
||||
ip link set wlan0 up
|
||||
wpa_supplicant -D wext -B -iwlan0 -c /etc/wpa_supplicant/wpa_supplicant.conf -P /var/run/wpa_supplicant.pid
|
||||
ifup wlan0
|
||||
echo "OK"
|
||||
}
|
||||
|
||||
stop() {
|
||||
printf "Stopping Wi-Fi connection: "
|
||||
start-stop-daemon -K -q -p /var/run/wpa_supplicant.pid
|
||||
ifdown wlan0
|
||||
# rmmod brcmfmac
|
||||
rmmod r8188eu
|
||||
echo "OK"
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
start
|
||||
;;
|
||||
stop)
|
||||
stop
|
||||
;;
|
||||
restart|reload)
|
||||
stop
|
||||
start
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $0 {start|stop|restart}"
|
||||
exit 1
|
||||
esac
|
||||
|
||||
exit $?
|
27
raspberrypi/board/robotech/cdfprincipal/rootfs_overlay/etc/extra.d/rcK
Executable file
27
raspberrypi/board/robotech/cdfprincipal/rootfs_overlay/etc/extra.d/rcK
Executable file
|
@ -0,0 +1,27 @@
|
|||
#!/bin/sh
|
||||
|
||||
|
||||
# Stop all init scripts in /etc/extra.d
|
||||
# executing them in reversed numerical order.
|
||||
#
|
||||
for i in $(ls -r /etc/extra.d/S??*) ;do
|
||||
|
||||
# Ignore dangling symlinks (if any).
|
||||
[ ! -f "$i" ] && continue
|
||||
|
||||
case "$i" in
|
||||
*.sh)
|
||||
# Source shell script for speed.
|
||||
(
|
||||
trap - INT QUIT TSTP
|
||||
set stop
|
||||
. $i
|
||||
)
|
||||
;;
|
||||
*)
|
||||
# No sh extension, so fork subprocess.
|
||||
$i stop
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
27
raspberrypi/board/robotech/cdfprincipal/rootfs_overlay/etc/extra.d/rcS
Executable file
27
raspberrypi/board/robotech/cdfprincipal/rootfs_overlay/etc/extra.d/rcS
Executable file
|
@ -0,0 +1,27 @@
|
|||
#!/bin/sh
|
||||
|
||||
|
||||
# Start all init scripts in /etc/extra.d
|
||||
# executing them in numerical order.
|
||||
#
|
||||
for i in /etc/extra.d/S??* ;do
|
||||
|
||||
# Ignore dangling symlinks (if any).
|
||||
[ ! -f "$i" ] && continue
|
||||
|
||||
case "$i" in
|
||||
*.sh)
|
||||
# Source shell script for speed.
|
||||
(
|
||||
trap - INT QUIT TSTP
|
||||
set start
|
||||
. $i
|
||||
)
|
||||
;;
|
||||
*)
|
||||
# No sh extension, so fork subprocess.
|
||||
$i start
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# Changes keyboard layout to AZERTY
|
||||
#
|
||||
|
||||
start() {
|
||||
printf "Starting AZERTY keyboard: "
|
||||
loadkmap < /usr/share/keyboard/fr-latin9.bmap
|
||||
echo "OK"
|
||||
}
|
||||
|
||||
stop() {
|
||||
printf "Stopping AZERTY keyboard: "
|
||||
echo "OK"
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
start
|
||||
;;
|
||||
stop)
|
||||
stop
|
||||
;;
|
||||
restart|reload)
|
||||
stop
|
||||
start
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $0 {start|stop|restart}"
|
||||
exit 1
|
||||
esac
|
||||
|
||||
exit $?
|
38
raspberrypi/board/robotech/cdfprincipal/rootfs_overlay/etc/init.d/S50chef
Executable file
38
raspberrypi/board/robotech/cdfprincipal/rootfs_overlay/etc/init.d/S50chef
Executable file
|
@ -0,0 +1,38 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# Start main program
|
||||
#
|
||||
|
||||
EXEC=$(which sh)
|
||||
PIDFILE=/var/run/chef.pid
|
||||
LOGFILE=/var/run/chef.log
|
||||
|
||||
start() {
|
||||
printf "Starting chef: "
|
||||
start-stop-daemon -p "$PIDFILE" -x "$EXEC" -b -m -S -- "/opt/chef/run.sh" -l "$LOGFILE"
|
||||
echo "OK"
|
||||
}
|
||||
|
||||
stop() {
|
||||
printf "Stopping chef: "
|
||||
start-stop-daemon -p "$PIDFILE" -x "$EXEC" -K
|
||||
echo "OK"
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
start
|
||||
;;
|
||||
stop)
|
||||
stop
|
||||
;;
|
||||
restart|reload)
|
||||
stop
|
||||
start
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $0 {start|stop|restart}"
|
||||
exit 1
|
||||
esac
|
||||
|
||||
exit $?
|
37
raspberrypi/board/robotech/cdfprincipal/rootfs_overlay/etc/init.d/S90extra
Executable file
37
raspberrypi/board/robotech/cdfprincipal/rootfs_overlay/etc/init.d/S90extra
Executable file
|
@ -0,0 +1,37 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# Start extra services when not in debug mode
|
||||
#
|
||||
|
||||
start() {
|
||||
printf "Starting extra services: "
|
||||
if ! /opt/cdf/bin/testpin 0 1
|
||||
then
|
||||
/etc/extra.d/rcS
|
||||
fi
|
||||
echo "OK"
|
||||
}
|
||||
|
||||
stop() {
|
||||
printf "Stopping extra services: "
|
||||
/etc/extra.d/rcK
|
||||
echo "OK"
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
start
|
||||
;;
|
||||
stop)
|
||||
stop
|
||||
;;
|
||||
restart|reload)
|
||||
stop
|
||||
start
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $0 {start|stop|restart}"
|
||||
exit 1
|
||||
esac
|
||||
|
||||
exit $?
|
|
@ -0,0 +1,13 @@
|
|||
#/bin/bash
|
||||
|
||||
alias la='ls -al'
|
||||
alias ll='ls -l'
|
||||
alias cp="cp -i"
|
||||
alias mv="mv -i"
|
||||
alias free='free -m'
|
||||
alias df='df -h'
|
||||
|
||||
export PS1="[\u@\h \$] "
|
||||
export PS2="> "
|
||||
export PS3="+ "
|
||||
export PS4="- "
|
Binary file not shown.
1
raspberrypi/buildroot
Submodule
1
raspberrypi/buildroot
Submodule
|
@ -0,0 +1 @@
|
|||
Subproject commit 8f03647169a17b10503594e5f3d95113a01171f9
|
87
raspberrypi/configs/cdfprincipal_defconfig
Normal file
87
raspberrypi/configs/cdfprincipal_defconfig
Normal file
|
@ -0,0 +1,87 @@
|
|||
# From configs/raspberrypi3_defconfig
|
||||
|
||||
BR2_arm=y
|
||||
BR2_cortex_a7=y
|
||||
BR2_ARM_EABIHF=y
|
||||
BR2_ARM_FPU_NEON_VFPV4=y
|
||||
|
||||
BR2_TOOLCHAIN_BUILDROOT_CXX=y
|
||||
|
||||
BR2_SYSTEM_DHCP="eth0"
|
||||
|
||||
# Linux headers same as kernel, a 4.4 series
|
||||
BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_4_4=y
|
||||
|
||||
BR2_LINUX_KERNEL=y
|
||||
BR2_LINUX_KERNEL_CUSTOM_GIT=y
|
||||
BR2_LINUX_KERNEL_CUSTOM_REPO_URL="https://github.com/raspberrypi/linux.git"
|
||||
BR2_LINUX_KERNEL_CUSTOM_REPO_VERSION="1ebe8d4a4c96cd6a90805c74233a468854960f67"
|
||||
BR2_LINUX_KERNEL_DEFCONFIG="bcm2709"
|
||||
|
||||
# Build the DTB from the kernel sources
|
||||
BR2_LINUX_KERNEL_DTS_SUPPORT=y
|
||||
BR2_LINUX_KERNEL_INTREE_DTS_NAME="bcm2710-rpi-3-b"
|
||||
|
||||
BR2_PACKAGE_RPI_FIRMWARE=y
|
||||
BR2_PACKAGE_RPI_FIRMWARE_INSTALL_DTB_OVERLAYS=y
|
||||
|
||||
# Required tools to create the SD image
|
||||
BR2_PACKAGE_HOST_DOSFSTOOLS=y
|
||||
BR2_PACKAGE_HOST_GENIMAGE=y
|
||||
BR2_PACKAGE_HOST_MTOOLS=y
|
||||
|
||||
# Filesystem / image
|
||||
BR2_TARGET_ROOTFS_EXT2=y
|
||||
BR2_TARGET_ROOTFS_EXT2_4=y
|
||||
# BR2_TARGET_ROOTFS_TAR is not set
|
||||
BR2_ROOTFS_POST_BUILD_SCRIPT="board/raspberrypi3/post-build.sh"
|
||||
BR2_ROOTFS_POST_IMAGE_SCRIPT="board/raspberrypi3/post-image.sh"
|
||||
BR2_ROOTFS_POST_SCRIPT_ARGS="--add-pi3-miniuart-bt-overlay"
|
||||
|
||||
|
||||
# Custom
|
||||
|
||||
# Pour accélerer la compilation
|
||||
BR2_TOOLCHAIN_EXTERNAL=y
|
||||
BR2_CCACHE=y
|
||||
|
||||
# Pour faire joli
|
||||
BR2_TARGET_GENERIC_HOSTNAME="principal"
|
||||
BR2_TARGET_GENERIC_ISSUE="Robotech - CdF 2018 - Robot principal"
|
||||
|
||||
# Configuration noyau supplémentaire
|
||||
BR2_LINUX_KERNEL_CONFIG_FRAGMENT_FILES="${BR2_EXTERNAL_CDF_PATH}/board/robotech/cdfprincipal/linux-extra.conf"
|
||||
# TODO Not working
|
||||
|
||||
# Paquets nécessaires
|
||||
BR2_PACKAGE_CHEF=y
|
||||
|
||||
# Fichiers supplémentaires
|
||||
BR2_ROOTFS_OVERLAY="${BR2_EXTERNAL_CDF_PATH}/board/robotech/cdfprincipal/rootfs_overlay/"
|
||||
BR2_ROOTFS_POST_BUILD_SCRIPT="board/raspberrypi3/post-build.sh ${BR2_EXTERNAL_CDF_PATH}/board/robotech/cdfprincipal/post-build.sh"
|
||||
|
||||
# Ne pas activer la connexion ethernet par défaut
|
||||
BR2_SYSTEM_DHCP=""
|
||||
|
||||
# Pour le Wi-Fi
|
||||
BR2_PACKAGE_LINUX_FIRMWARE=y
|
||||
BR2_PACKAGE_LINUX_FIRMWARE_RTL_81XX=y # Clef Wi-Fi Geoffrey
|
||||
#BR2_PACKAGE_LINUX_FIRMWARE_BRCM_BCM43XXX=y # RPi3 Natif (cassé physiquement sur notre carte)
|
||||
BR2_PACKAGE_WPA_SUPPLICANT=y
|
||||
|
||||
# Pour upgrader à chaud
|
||||
BR2_PACKAGE_DROPBEAR=y
|
||||
BR2_PACKAGE_RSYNC=y
|
||||
|
||||
# Pour faire plaisir à Geoffrey
|
||||
BR2_PACKAGE_HTOP=y
|
||||
|
||||
# Pour uploader sur le Arduino
|
||||
BR2_TOOLCHAIN_BUILDROOT_WCHAR=y
|
||||
BR2_SHARED_LIBS=y
|
||||
BR2_PACKAGE_UCLIBC=y
|
||||
BR2_PACKAGE_AVRDUDE=y
|
||||
|
||||
# Pour uploader sur le FPGA
|
||||
BR2_PACKAGE_MERCPCL=y
|
||||
|
2
raspberrypi/external.desc
Normal file
2
raspberrypi/external.desc
Normal file
|
@ -0,0 +1,2 @@
|
|||
name: CDF
|
||||
desc: Robotech - Coupe de France de Robotique - Robot principal
|
1
raspberrypi/external.mk
Normal file
1
raspberrypi/external.mk
Normal file
|
@ -0,0 +1 @@
|
|||
include $(sort $(wildcard $(BR2_EXTERNAL_CDF_PATH)/package/*/*.mk))
|
1
raspberrypi/package/cr1901/Config.in
Normal file
1
raspberrypi/package/cr1901/Config.in
Normal file
|
@ -0,0 +1 @@
|
|||
source "$BR2_EXTERNAL_CDF_PATH/package/cr1901/mercpcl/Config.in"
|
1
raspberrypi/package/cr1901/cr1901.mk
Normal file
1
raspberrypi/package/cr1901/cr1901.mk
Normal file
|
@ -0,0 +1 @@
|
|||
include $(sort $(wildcard $(BR2_EXTERNAL_CDF_PATH)/package/cr1901/*/*.mk))
|
7
raspberrypi/package/cr1901/mercpcl/Config.in
Normal file
7
raspberrypi/package/cr1901/mercpcl/Config.in
Normal file
|
@ -0,0 +1,7 @@
|
|||
config BR2_PACKAGE_MERCPCL
|
||||
bool "mercpcl"
|
||||
select BR2_PACKAGE_LIBUSB
|
||||
select BR2_PACKAGE_LIBFTDI
|
||||
help
|
||||
Command-line utility that can be used to program
|
||||
Mercury FPGA development boards.
|
13
raspberrypi/package/cr1901/mercpcl/mercpcl.mk
Normal file
13
raspberrypi/package/cr1901/mercpcl/mercpcl.mk
Normal file
|
@ -0,0 +1,13 @@
|
|||
################################################################################
|
||||
#
|
||||
# mercpcl
|
||||
#
|
||||
################################################################################
|
||||
|
||||
MERCPCL_VERSION = ce3d815f76f8f5d7254e5e17a90e30d9affacfea
|
||||
MERCPCL_SITE = $(call github,cr1901,mercpcl,$(MERCPCL_VERSION))
|
||||
MERCPCL_DEPENDENCIES = libftdi libusb
|
||||
MERCPCL_LICENSE = GPLv3
|
||||
MERCPCL_LICENSE_FILES = LICENSE
|
||||
|
||||
$(eval $(cmake-package))
|
1
raspberrypi/package/robotech/Config.in
Normal file
1
raspberrypi/package/robotech/Config.in
Normal file
|
@ -0,0 +1 @@
|
|||
source "$BR2_EXTERNAL_CDF_PATH/package/robotech/chef/Config.in"
|
6
raspberrypi/package/robotech/chef/Config.in
Normal file
6
raspberrypi/package/robotech/chef/Config.in
Normal file
|
@ -0,0 +1,6 @@
|
|||
config BR2_PACKAGE_CHEF
|
||||
bool "chef"
|
||||
select BR2_PACKAGE_WIRINGPI
|
||||
help
|
||||
Cerveau du robot principal pour la Coupe de France
|
||||
de Robotique, équipe Robotech Lille (Polytech Lille).
|
23
raspberrypi/package/robotech/chef/chef.mk
Normal file
23
raspberrypi/package/robotech/chef/chef.mk
Normal file
|
@ -0,0 +1,23 @@
|
|||
################################################################################
|
||||
#
|
||||
# Programme chef - Coupe de France de Robotique
|
||||
#
|
||||
################################################################################
|
||||
CHEF_VERSION = 1.0
|
||||
CHEF_SITE = $(BR2_EXTERNAL_CDF_PATH)/package/robotech/chef/code
|
||||
CHEF_SITE_METHOD = local
|
||||
CHEF_DEPENDENCIES = wiringpi
|
||||
|
||||
define CHEF_BUILD_CMDS
|
||||
$(MAKE) -C $(@D) clean
|
||||
$(MAKE) $(TARGET_CONFIGURE_OPTS) -C $(@D)
|
||||
endef
|
||||
|
||||
define CHEF_INSTALL_TARGET_CMDS
|
||||
$(INSTALL) -d -m 0755 $(TARGET_DIR)/opt/chef/bin
|
||||
$(INSTALL) -d -m 0755 $(TARGET_DIR)/opt/chef/com
|
||||
$(INSTALL) -D -m 0755 $(@D)/bin/* $(TARGET_DIR)/opt/chef/bin
|
||||
$(INSTALL) -D -m 0755 $(@D)/run.sh $(TARGET_DIR)/opt/chef
|
||||
endef
|
||||
|
||||
$(eval $(generic-package))
|
1
raspberrypi/package/robotech/chef/code
Symbolic link
1
raspberrypi/package/robotech/chef/code
Symbolic link
|
@ -0,0 +1 @@
|
|||
../../../../chef
|
1
raspberrypi/package/robotech/robotech.mk
Normal file
1
raspberrypi/package/robotech/robotech.mk
Normal file
|
@ -0,0 +1 @@
|
|||
include $(sort $(wildcard $(BR2_EXTERNAL_CDF_PATH)/package/robotech/*/*.mk))
|
11
raspberrypi/principalconf.sh.demo
Normal file
11
raspberrypi/principalconf.sh.demo
Normal file
|
@ -0,0 +1,11 @@
|
|||
WPASSID="MySSID"
|
||||
WPAKEYMGMT="WPA-PSK"
|
||||
WPAPSK=mypassword
|
||||
ADDRESS=192.168.1.42
|
||||
NETMASK=255.255.255.0
|
||||
GATEWAY=192.168.1.1
|
||||
SSHCPUB="ecdsa-sha2-nistp256 ... principal@robotech"
|
||||
SSHCPRV="-----BEGIN EC PRIVATE KEY-----
|
||||
...
|
||||
-----END EC PRIVATE KEY-----"
|
||||
SSHSPRV="..."
|
6
raspberrypi/sshconf.bkp
Normal file
6
raspberrypi/sshconf.bkp
Normal file
|
@ -0,0 +1,6 @@
|
|||
Host principal p
|
||||
User root
|
||||
Hostname 192.168.43.72
|
||||
PreferredAuthentications publickey
|
||||
PubkeyAuthentication yes
|
||||
IdentityFile "/home/geoffrey/CdF/cdf2018-principal/root/sshkey"
|
Loading…
Reference in a new issue