risc-v/esp32c3: Add ESP32-C3 basic support

Co-authored-by: Dong Heng <dongheng@espressif.com>
Co-authored-by: Abdelatif Guettouche <abdelatif.guettouche@espressif.com>
This commit is contained in:
Dong Heng
2021-01-21 20:13:10 +08:00
committed by Brennan Ashton
parent 74c56f53aa
commit b11a5ca8b2
29 changed files with 5252 additions and 0 deletions

View File

@@ -0,0 +1,88 @@
/****************************************************************************
* arch/risc-v/src/esp32c3/esp32c3_start.c
*
* 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.
*
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <nuttx/arch.h>
#include <nuttx/init.h>
#include <arch/board/board.h>
#include "chip.h"
#include "esp32c3.h"
#include "esp32c3_irq.h"
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
#ifdef CONFIG_DEBUG_FEATURES
# define showprogress(c) ets_printf("%c", c)
#else
# define showprogress(c)
#endif
/****************************************************************************
* Public Data
****************************************************************************/
/* Address of the IDLE thread */
uint8_t g_idlestack[ESP32C3_IDLESTACK_SIZE]
__attribute__((aligned(16), section(".noinit")));
uint32_t g_idle_topstack = ESP32C3_IDLESTACK_TOP;
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: __esp32c3_start
****************************************************************************/
void __esp32c3_start(void)
{
uint32_t *dest;
showprogress('A');
/* Clear .bss. We'll do this inline (vs. calling memset) just to be
* certain that there are no issues with the state of global variables.
*/
for (dest = &_sbss; dest < &_ebss; dest++)
{
*dest = 0;
}
showprogress('B');
/* Call nx_start() */
nx_start();
/* Shouldn't get here */
for (; ; );
}