Skip to content

Commit

Permalink
Cleanup of sys and its macro
Browse files Browse the repository at this point in the history
  • Loading branch information
NIIBE Yutaka committed May 31, 2016
1 parent 421fd80 commit 3a4e1f2
Show file tree
Hide file tree
Showing 29 changed files with 161 additions and 904 deletions.
7 changes: 7 additions & 0 deletions ChangeLog
@@ -1,3 +1,10 @@
2016-05-31 NIIBE Yutaka <gniibe@fsij.org>

* sys.h: New.

* example-cdc, example-fs-bb48: Update.
* example-fsm-55, example-led: Update.

2016-05-30 NIIBE Yutaka <gniibe@fsij.org>

* mcu/usb-stm32f103.c (usb_lld_setup_endpoint): Start with
Expand Down
19 changes: 9 additions & 10 deletions entry.c
Expand Up @@ -31,21 +31,20 @@
#include <stdlib.h>
#include <chopstx.h>

#ifdef HAVE_SYS_H
#define INLINE __attribute__ ((used))
#include "board.h"
#ifdef MCU_KINETIS_L
#include "mcu/sys-mkl27z.h"
#else
#include "mcu/sys-stm32f103.h"
#undef STM32F10X_MD /* Prepare for high density device, too. */
#endif
#if defined(USE_SYS3) || defined(USE_SYS_CLOCK_GPIO_SETTING)
#define REQUIRE_CLOCK_GPIO_SETTING_IN_SYS
#include "sys.h"
/*
* Avoid medium density specific code and prepare for high density
* device, too.
*/
#undef STM32F10X_MD
#else
#include "board.h"
#if defined (MCU_KINETIS_L)
#include "mcu/clk_gpio_init-mkl27z.c"
#else
#include "mcu/clk_gpio_init-stm32f103.c"
#include "mcu/clk_gpio_init-stm32.c"
#endif
#endif

Expand Down
2 changes: 1 addition & 1 deletion example-cdc/Makefile
Expand Up @@ -19,7 +19,7 @@ OBJCOPY = $(CROSS)objcopy

MCU = cortex-m3
CWARN = -Wall -Wextra -Wstrict-prototypes
DEFS = -DHAVE_SYS_H -DFREE_STANDING
DEFS = -DUSE_SYS3 -DFREE_STANDING
OPT = -O3 -Os -g
LIBS =

Expand Down
6 changes: 1 addition & 5 deletions example-cdc/sample.c
Expand Up @@ -8,11 +8,7 @@

/* For set_led */
#include "board.h"
#ifdef MCU_KINETIS_L
#include "mcu/sys-mkl27z.h"
#else
#include "mcu/sys-stm32f103.h"
#endif
#include "sys.h"

static chopstx_mutex_t mtx;
static chopstx_cond_t cnd0;
Expand Down
10 changes: 5 additions & 5 deletions example-cdc/sample.ld
@@ -1,11 +1,11 @@
/*
* ST32F103 memory setup.
*/
__main_stack_size__ = 0x0100; /* Exception handlers */
__process0_stack_size__ = 0x0400; /* Main program */
__process1_stack_size__ = 0x0200; /* first thread program */
__process2_stack_size__ = 0x0200; /* second thread program */
__process3_stack_size__ = 0x0200; /* third thread program */
__main_stack_size__ = 0x0100; /* Idle+Exception handlers */
__process0_stack_size__ = 0x0400; /* Main program */
__process1_stack_size__ = 0x0200; /* first thread program */
__process2_stack_size__ = 0x0200; /* second thread program */
__process3_stack_size__ = 0x0200; /* third thread program */

MEMORY
{
Expand Down
2 changes: 1 addition & 1 deletion example-fs-bb48/Makefile
Expand Up @@ -21,7 +21,7 @@ OBJCOPY = $(CROSS)objcopy

MCU = cortex-m0plus
CWARN = -Wall -Wextra -Wstrict-prototypes
DEFS = -DFREE_STANDING -DMHZ=48 -DHAVE_SYS_H
DEFS = -DFREE_STANDING -DMHZ=48 -DUSE_SYS3
OPT = -O3 -Os -g
LIBS =

Expand Down
7 changes: 1 addition & 6 deletions example-fs-bb48/command.c
Expand Up @@ -8,12 +8,7 @@
static int adc_initialized = 0;
#endif
#include "board.h"
#ifdef MCU_KINETIS_L
#include "mcu/sys-mkl27z.h"
#else
#include "mcu/sys-stm32.h"
#undef STM32F10X_MD /* Prepare for high density device, too. */
#endif
#include "sys.h"

struct command_table
{
Expand Down
10 changes: 5 additions & 5 deletions example-fs-bb48/sample.ld
@@ -1,11 +1,11 @@
/*
* MK27Z memory setup.
*/
__main_stack_size__ = 0x0100; /* Exception handlers */
__process0_stack_size__ = 0x0300; /* Main program */
__process1_stack_size__ = 0x0200; /* first thread program */
__process2_stack_size__ = 0x0100; /* second thread program */
__process3_stack_size__ = 0x0200; /* third thread program */
__main_stack_size__ = 0x0100; /* Idle+Exception handlers */
__process0_stack_size__ = 0x0300; /* Main program */
__process1_stack_size__ = 0x0200; /* first thread program */
__process2_stack_size__ = 0x0100; /* second thread program */
__process3_stack_size__ = 0x0200; /* third thread program */

MEMORY
{
Expand Down
10 changes: 5 additions & 5 deletions example-fsm-55/Makefile
Expand Up @@ -5,16 +5,16 @@ PROJECT = hacker-emblem
CHOPSTX = ..
LDSCRIPT= hacker-emblem.ld

CSRC = sys.c hh.c
CSRC = reset.c hh.c

# Hacker Emblem and "Happy Hacking!" demonstration
# CSRC = sys.c hh.c
# CSRC = reset.c hh.c

# Debian logo demonstration
# CSRC = sys.c debian-logo.c
# CSRC = reset.c debian-logo.c

# "Hiroshi & Ayumi with Tulip" demonstration
# CSRC = sys.c hiroshi-ayumi.c
# CSRC = reset.c hiroshi-ayumi.c

###################################
CROSS = arm-none-eabi-
Expand All @@ -36,7 +36,7 @@ board.h:
@echo Please make a symbolic link \'board.h\' to a file in ../board;
@exit 1

sys.c: board.h
reset.c: board.h

distclean: clean
rm -f board.h
10 changes: 5 additions & 5 deletions example-fsm-55/hacker-emblem.ld
@@ -1,11 +1,11 @@
/*
* ST32F0 memory setup.
*/
__main_stack_size__ = 0x0100; /* Exception handlers */
__process0_stack_size__ = 0x0100; /* Main program */
__process1_stack_size__ = 0x0100; /* first thread program */
__process2_stack_size__ = 0x0100; /* second thread program */
__process3_stack_size__ = 0x0100; /* third thread program */
__main_stack_size__ = 0x0100; /* Idle+Exception handlers */
__process0_stack_size__ = 0x0100; /* Main program */
__process1_stack_size__ = 0x0100; /* first thread program */
__process2_stack_size__ = 0x0100; /* second thread program */
__process3_stack_size__ = 0x0100; /* third thread program */

MEMORY
{
Expand Down
4 changes: 2 additions & 2 deletions example-fsm-55/sys.c → example-fsm-55/reset.c
@@ -1,5 +1,5 @@
/*
* sys.c - No system routines, but only RESET handler for STM32F030.
* reset.c - No system routines, but only RESET handler for STM32F030.
*
* Copyright (C) 2015 Flying Stone Technology
* Author: NIIBE Yutaka <gniibe@fsij.org>
Expand Down Expand Up @@ -70,7 +70,7 @@ typedef void (*handler)(void);
extern uint8_t __main_stack_end__;

handler vector[] __attribute__ ((section(".vectors"))) = {
(handler)&__main_stack_end__,
(handler)(&__main_stack_end__ - 32),
reset,
nmi, /* nmi */
hard_fault, /* hard fault */
Expand Down
10 changes: 6 additions & 4 deletions example-led/Makefile
Expand Up @@ -8,8 +8,10 @@ PROJECT = sample
CHOPSTX = ..
LDSCRIPT= sample.ld
### LDSCRIPT= sample.ld.m3
CSRC = sys.c sample.c
### CSRC = sys.c aes-constant-ft.c sample.c
CSRC = sample.c

CHIP=stm32f030
USE_SYS = yes

###################################
CROSS = arm-none-eabi-
Expand All @@ -20,8 +22,8 @@ OBJCOPY = $(CROSS)objcopy
### MCU = cortex-m3
MCU = cortex-m0
CWARN = -Wall -Wextra -Wstrict-prototypes
DEFS = -DHAVE_SYS_H -DFREE_STANDING -DMHZ=48
### DEFS = -DFREE_STANDING -DHAVE_SYS_H -DBUSY_LOOP -DCHX_FLAGS_MAIN=CHOPSTX_SCHED_RR
DEFS = -DUSE_SYS3 -DFREE_STANDING -DMHZ=48
### DEFS = -DFREE_STANDING -DUSE_SYS3 -DBUSY_LOOP -DCHX_FLAGS_MAIN=CHOPSTX_SCHED_RR
OPT = -O3 -Os -g
LIBS =

Expand Down
145 changes: 0 additions & 145 deletions example-led/aes-constant-ft.c

This file was deleted.

18 changes: 9 additions & 9 deletions example-led/sample.ld
@@ -1,11 +1,11 @@
/*
* ST32F0 memory setup.
*/
__main_stack_size__ = 0x0100; /* Exception handlers */
__process0_stack_size__ = 0x0100; /* Main program */
__process1_stack_size__ = 0x0100; /* first thread program */
__process2_stack_size__ = 0x0100; /* second thread program */
__process3_stack_size__ = 0x0100; /* third thread program */
__main_stack_size__ = 0x0100; /* Idle+Exception handlers */
__process0_stack_size__ = 0x0100; /* Main program */
__process1_stack_size__ = 0x0100; /* first thread program */
__process2_stack_size__ = 0x0100; /* second thread program */
__process3_stack_size__ = 0x0100; /* third thread program */

MEMORY
{
Expand All @@ -30,10 +30,10 @@ SECTIONS
KEEP(*(.sys.version))
KEEP(*(.sys.board_id))
KEEP(*(.sys.board_name))
build/sys.o(.text)
build/sys.o(.text.*)
build/sys.o(.rodata)
build/sys.o(.rodata.*)
build/sys-*.o(.text)
build/sys-*.o(.text.*)
build/sys-*.o(.rodata)
build/sys-*.o(.rodata.*)
. = ALIGN(1024);
/*
*(.sys.0)
Expand Down

0 comments on commit 3a4e1f2

Please sign in to comment.