mirror of
https://github.com/apache/nuttx.git
synced 2025-01-13 02:48:37 +08:00
Compare commits
6 commits
1843bc2555
...
8ddff521c1
Author | SHA1 | Date | |
---|---|---|---|
|
8ddff521c1 | ||
|
ff488133c9 | ||
|
48846954d8 | ||
|
657247bda8 | ||
|
be40c01ddd | ||
|
b9f353e31e |
9 changed files with 155 additions and 38 deletions
|
@ -546,7 +546,9 @@ ifeq ($(CONFIG_PIC),y)
|
|||
# Generate an executable elf, need to ignore undefined symbols
|
||||
LDELFFLAGS += --unresolved-symbols=ignore-in-object-files --emit-relocs
|
||||
else
|
||||
LDELFFLAGS += -r
|
||||
ifneq ($(CONFIG_BINFMT_ELF_EXECUTABLE),y)
|
||||
LDELFFLAGS += -r
|
||||
endif
|
||||
endif
|
||||
|
||||
LDELFFLAGS += -e main -T $(call CONVERT_PATH,$(TOPDIR)$(DELIM)libs$(DELIM)libc$(DELIM)modlib$(DELIM)gnu-elf.ld)
|
||||
|
|
|
@ -15,6 +15,7 @@ config ARCH_CHIP_QEMU_CORTEXA7
|
|||
bool "Qemu virtual Processor (cortex-a7)"
|
||||
select ARCH_CORTEXA7
|
||||
select ARCH_HAVE_ADDRENV
|
||||
select ARCH_HAVE_ELF_EXECUTABLE
|
||||
select ARCH_HAVE_LOWVECTORS
|
||||
select ARCH_HAVE_MULTICPU
|
||||
select ARCH_NEED_ADDRENV_MAPPING
|
||||
|
|
|
@ -333,6 +333,10 @@ static int stm32_tim_setmode(struct stm32_tim_dev_s *dev,
|
|||
stm32_tim_mode_t mode);
|
||||
static int stm32_tim_setclock(struct stm32_tim_dev_s *dev,
|
||||
uint32_t freq);
|
||||
static uint32_t stm32_tim_getprescaler(struct stm32_tim_dev_s *dev);
|
||||
static void stm32_tim_setprescaler(struct stm32_tim_dev_s *dev,
|
||||
uint32_t prescaler);
|
||||
static uint32_t stm32_tim_getperiod(struct stm32_tim_dev_s *dev);
|
||||
static void stm32_tim_setperiod(struct stm32_tim_dev_s *dev,
|
||||
uint32_t period);
|
||||
static uint32_t stm32_tim_getcounter(struct stm32_tim_dev_s *dev);
|
||||
|
@ -360,22 +364,25 @@ static int stm32_tim_checkint(struct stm32_tim_dev_s *dev, int source);
|
|||
|
||||
static const struct stm32_tim_ops_s stm32_tim_ops =
|
||||
{
|
||||
.enable = stm32_tim_enable,
|
||||
.disable = stm32_tim_disable,
|
||||
.setmode = stm32_tim_setmode,
|
||||
.setclock = stm32_tim_setclock,
|
||||
.setperiod = stm32_tim_setperiod,
|
||||
.getcounter = stm32_tim_getcounter,
|
||||
.setcounter = stm32_tim_setcounter,
|
||||
.getwidth = stm32_tim_getwidth,
|
||||
.setchannel = stm32_tim_setchannel,
|
||||
.setcompare = stm32_tim_setcompare,
|
||||
.getcapture = stm32_tim_getcapture,
|
||||
.setisr = stm32_tim_setisr,
|
||||
.enableint = stm32_tim_enableint,
|
||||
.disableint = stm32_tim_disableint,
|
||||
.ackint = stm32_tim_ackint,
|
||||
.checkint = stm32_tim_checkint,
|
||||
.enable = stm32_tim_enable,
|
||||
.disable = stm32_tim_disable,
|
||||
.setmode = stm32_tim_setmode,
|
||||
.setclock = stm32_tim_setclock,
|
||||
.setprescaler = stm32_tim_setprescaler,
|
||||
.getprescaler = stm32_tim_getprescaler,
|
||||
.getperiod = stm32_tim_getperiod,
|
||||
.setperiod = stm32_tim_setperiod,
|
||||
.getcounter = stm32_tim_getcounter,
|
||||
.setcounter = stm32_tim_setcounter,
|
||||
.getwidth = stm32_tim_getwidth,
|
||||
.setchannel = stm32_tim_setchannel,
|
||||
.setcompare = stm32_tim_setcompare,
|
||||
.getcapture = stm32_tim_getcapture,
|
||||
.setisr = stm32_tim_setisr,
|
||||
.enableint = stm32_tim_enableint,
|
||||
.disableint = stm32_tim_disableint,
|
||||
.ackint = stm32_tim_ackint,
|
||||
.checkint = stm32_tim_checkint,
|
||||
};
|
||||
|
||||
#ifdef CONFIG_STM32_TIM1
|
||||
|
@ -899,6 +906,41 @@ static int stm32_tim_setclock(struct stm32_tim_dev_s *dev, uint32_t freq)
|
|||
return prescaler;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: stm32_tim_getprescaler
|
||||
****************************************************************************/
|
||||
|
||||
static uint32_t stm32_tim_getprescaler(struct stm32_tim_dev_s *dev)
|
||||
{
|
||||
DEBUGASSERT(dev != NULL);
|
||||
return stm32_tim_getwidth(dev) > 16 ?
|
||||
stm32_getreg32(dev, STM32_GTIM_PSC_OFFSET) :
|
||||
(uint32_t)stm32_getreg16(dev, STM32_GTIM_PSC_OFFSET);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: stm32_tim_setprescaler
|
||||
****************************************************************************/
|
||||
|
||||
static void stm32_tim_setprescaler(struct stm32_tim_dev_s *dev,
|
||||
uint32_t prescaler)
|
||||
{
|
||||
DEBUGASSERT(dev != NULL);
|
||||
stm32_putreg32(dev, STM32_GTIM_PSC_OFFSET, prescaler);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: stm32_tim_getperiod
|
||||
****************************************************************************/
|
||||
|
||||
static uint32_t stm32_tim_getperiod(struct stm32_tim_dev_s *dev)
|
||||
{
|
||||
DEBUGASSERT(dev != NULL);
|
||||
return stm32_tim_getwidth(dev) > 16 ?
|
||||
stm32_getreg32(dev, STM32_GTIM_ARR_OFFSET) :
|
||||
(uint32_t)stm32_getreg16(dev, STM32_GTIM_ARR_OFFSET);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: stm32_tim_setperiod
|
||||
****************************************************************************/
|
||||
|
|
|
@ -40,22 +40,25 @@
|
|||
|
||||
/* Helpers ******************************************************************/
|
||||
|
||||
#define STM32_TIM_SETMODE(d,mode) ((d)->ops->setmode(d,mode))
|
||||
#define STM32_TIM_SETCLOCK(d,freq) ((d)->ops->setclock(d,freq))
|
||||
#define STM32_TIM_SETPERIOD(d,period) ((d)->ops->setperiod(d,period))
|
||||
#define STM32_TIM_GETCOUNTER(d) ((d)->ops->getcounter(d))
|
||||
#define STM32_TIM_SETCOUNTER(d,c) ((d)->ops->setcounter(d,c))
|
||||
#define STM32_TIM_GETWIDTH(d) ((d)->ops->getwidth(d))
|
||||
#define STM32_TIM_SETCHANNEL(d,ch,mode) ((d)->ops->setchannel(d,ch,mode))
|
||||
#define STM32_TIM_SETCOMPARE(d,ch,comp) ((d)->ops->setcompare(d,ch,comp))
|
||||
#define STM32_TIM_GETCAPTURE(d,ch) ((d)->ops->getcapture(d,ch))
|
||||
#define STM32_TIM_SETISR(d,hnd,arg,s) ((d)->ops->setisr(d,hnd,arg,s))
|
||||
#define STM32_TIM_ENABLEINT(d,s) ((d)->ops->enableint(d,s))
|
||||
#define STM32_TIM_DISABLEINT(d,s) ((d)->ops->disableint(d,s))
|
||||
#define STM32_TIM_ACKINT(d,s) ((d)->ops->ackint(d,s))
|
||||
#define STM32_TIM_CHECKINT(d,s) ((d)->ops->checkint(d,s))
|
||||
#define STM32_TIM_ENABLE(d) ((d)->ops->enable(d))
|
||||
#define STM32_TIM_DISABLE(d) ((d)->ops->disable(d))
|
||||
#define STM32_TIM_SETMODE(d,mode) ((d)->ops->setmode(d,mode))
|
||||
#define STM32_TIM_SETCLOCK(d,freq) ((d)->ops->setclock(d,freq))
|
||||
#define STM32_TIM_GETPRESCALER(d) ((d)->ops->getprescaler(d))
|
||||
#define STM32_TIM_SETPRESCALER(d,p) ((d)->ops->setprescaler(d,p))
|
||||
#define STM32_TIM_GETPERIOD(d) ((d)->ops->getperiod(d))
|
||||
#define STM32_TIM_SETPERIOD(d,p) ((d)->ops->setperiod(d,p))
|
||||
#define STM32_TIM_GETCOUNTER(d) ((d)->ops->getcounter(d))
|
||||
#define STM32_TIM_SETCOUNTER(d,c) ((d)->ops->setcounter(d,c))
|
||||
#define STM32_TIM_GETWIDTH(d) ((d)->ops->getwidth(d))
|
||||
#define STM32_TIM_SETCHANNEL(d,ch,mode) ((d)->ops->setchannel(d,ch,mode))
|
||||
#define STM32_TIM_SETCOMPARE(d,ch,comp) ((d)->ops->setcompare(d,ch,comp))
|
||||
#define STM32_TIM_GETCAPTURE(d,ch) ((d)->ops->getcapture(d,ch))
|
||||
#define STM32_TIM_SETISR(d,hnd,arg,s) ((d)->ops->setisr(d,hnd,arg,s))
|
||||
#define STM32_TIM_ENABLEINT(d,s) ((d)->ops->enableint(d,s))
|
||||
#define STM32_TIM_DISABLEINT(d,s) ((d)->ops->disableint(d,s))
|
||||
#define STM32_TIM_ACKINT(d,s) ((d)->ops->ackint(d,s))
|
||||
#define STM32_TIM_CHECKINT(d,s) ((d)->ops->checkint(d,s))
|
||||
#define STM32_TIM_ENABLE(d) ((d)->ops->enable(d))
|
||||
#define STM32_TIM_DISABLE(d) ((d)->ops->disable(d))
|
||||
|
||||
/****************************************************************************
|
||||
* Public Types
|
||||
|
@ -159,6 +162,9 @@ struct stm32_tim_ops_s
|
|||
void (*disable)(struct stm32_tim_dev_s *dev);
|
||||
int (*setmode)(struct stm32_tim_dev_s *dev, stm32_tim_mode_t mode);
|
||||
int (*setclock)(struct stm32_tim_dev_s *dev, uint32_t freq);
|
||||
uint32_t (*getprescaler)(struct stm32_tim_dev_s *dev);
|
||||
void (*setprescaler)(struct stm32_tim_dev_s *dev, uint32_t prescaler);
|
||||
uint32_t (*getperiod)(struct stm32_tim_dev_s *dev);
|
||||
void (*setperiod)(struct stm32_tim_dev_s *dev, uint32_t period);
|
||||
uint32_t (*getcounter)(struct stm32_tim_dev_s *dev);
|
||||
void (*setcounter)(struct stm32_tim_dev_s *dev, uint32_t count);
|
||||
|
|
|
@ -29,6 +29,8 @@
|
|||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
|
||||
#ifdef CONFIG_BUILD_KERNEL
|
||||
# include <signal.h>
|
||||
#endif
|
||||
|
@ -40,6 +42,8 @@
|
|||
|
||||
#include <arch/arch.h>
|
||||
|
||||
#endif /* __ASSEMBLY__ */
|
||||
|
||||
#ifdef CONFIG_ARCH_ADDRENV
|
||||
|
||||
/****************************************************************************
|
||||
|
@ -241,6 +245,9 @@
|
|||
(CONFIG_ARCH_PGPOOL_VBASE + CONFIG_ARCH_PGPOOL_SIZE)
|
||||
|
||||
#endif
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
|
||||
/****************************************************************************
|
||||
* Public Type Definitions
|
||||
****************************************************************************/
|
||||
|
@ -251,8 +258,6 @@ struct tcb_s; /* Forward reference to TCB */
|
|||
* Public Types
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
|
||||
struct addrenv_s
|
||||
{
|
||||
struct arch_addrenv_s addrenv; /* The address environment page directory */
|
||||
|
|
1
libs/libc/.gitignore
vendored
1
libs/libc/.gitignore
vendored
|
@ -1,2 +1,3 @@
|
|||
/exec_symtab.c
|
||||
/modlib_symtab.c
|
||||
modlib/gnu-elf.ld
|
||||
|
|
|
@ -183,6 +183,10 @@ context:: bin kbin
|
|||
ifeq ($(CONFIG_LIBC_ZONEINFO_ROMFS),y)
|
||||
$(Q) $(MAKE) -C zoneinfo context BIN=$(BIN)
|
||||
endif
|
||||
ifeq ($(CONFIG_LIBC_MODLIB),y)
|
||||
$(Q) $(MAKE) -C modlib context
|
||||
endif
|
||||
|
||||
|
||||
# Dependencies
|
||||
|
||||
|
@ -210,6 +214,7 @@ depend:: .depend
|
|||
|
||||
clean::
|
||||
$(Q) $(MAKE) -C zoneinfo clean BIN=$(BIN)
|
||||
$(Q) $(MAKE) -C modlib clean
|
||||
$(call DELFILE, $(BIN))
|
||||
$(call DELFILE, $(KBIN))
|
||||
$(call CLEAN)
|
||||
|
@ -218,6 +223,7 @@ clean::
|
|||
|
||||
distclean:: clean
|
||||
$(Q) $(MAKE) -C zoneinfo distclean BIN=$(BIN)
|
||||
$(Q) $(MAKE) -C modlib distclean
|
||||
$(call DELFILE, exec_symtab.c)
|
||||
$(call DELFILE, .depend)
|
||||
$(call DELDIR, bin)
|
||||
|
|
40
libs/libc/modlib/Makefile
Normal file
40
libs/libc/modlib/Makefile
Normal file
|
@ -0,0 +1,40 @@
|
|||
############################################################################
|
||||
# libs/libc/modlib/Makefile
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
# Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
# contributor license agreements. See the NOTICE file distributed with
|
||||
# this work for additional information regarding copyright ownership. The
|
||||
# ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||
# "License"); you may not use this file except in compliance with the
|
||||
# License. You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
#
|
||||
############################################################################
|
||||
|
||||
include $(TOPDIR)/Make.defs
|
||||
|
||||
# Generate gnu-elf.ld from gnu-elf.ld.in
|
||||
|
||||
gnu-elf.ld: gnu-elf.ld.in
|
||||
$(call PREPROCESS, $<, $@)
|
||||
|
||||
# Create initial context
|
||||
|
||||
context: gnu-elf.ld
|
||||
|
||||
.PHONY: context clean distclean
|
||||
|
||||
clean:
|
||||
$(call CLEAN)
|
||||
|
||||
distclean: clean
|
||||
$(call DELFILE, gnu-elf.ld)
|
|
@ -1,5 +1,5 @@
|
|||
/****************************************************************************
|
||||
* libs/libc/modlib/gnu-elf.ld
|
||||
* libs/libc/modlib/gnu-elf.ld.in
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
|
@ -18,9 +18,23 @@
|
|||
*
|
||||
****************************************************************************/
|
||||
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#if defined(CONFIG_BUILD_KERNEL) && defined(CONFIG_BINFMT_ELF_EXECUTABLE)
|
||||
# define __ASSEMBLY__
|
||||
# include <nuttx/addrenv.h>
|
||||
|
||||
# define TEXT CONFIG_ARCH_TEXT_VBASE
|
||||
# define DATA CONFIG_ARCH_DATA_VBASE + ARCH_DATA_RESERVE_SIZE
|
||||
#else
|
||||
# define TEXT 0x0
|
||||
# define DATA
|
||||
#endif
|
||||
|
||||
SECTIONS
|
||||
{
|
||||
.text 0x00000000 :
|
||||
.text TEXT :
|
||||
{
|
||||
_stext = . ;
|
||||
*(.text)
|
||||
|
@ -58,7 +72,7 @@ SECTIONS
|
|||
_erodata = . ;
|
||||
}
|
||||
|
||||
.data :
|
||||
.data DATA :
|
||||
{
|
||||
_sdata = . ;
|
||||
*(.data)
|
Loading…
Reference in a new issue