Skip to content

Commit

Permalink
Add ASF headers and split host uTVM API defs
Browse files Browse the repository at this point in the history
  • Loading branch information
Logan Weber committed Nov 10, 2019
1 parent 1d60271 commit 1ca1cda
Show file tree
Hide file tree
Showing 5 changed files with 98 additions and 7 deletions.
7 changes: 7 additions & 0 deletions src/runtime/micro/device/arm/stm32f746xx/utvm_init.s
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@
* specific language governing permissions and limitations
* under the License.
*/

/*!
* Copyright (c) 2019 by Contributors
* \file utvm_init.s
* \brief uTVM init definition for STM32F746XX-series boards
*/

.syntax unified
.cpu cortex-m7
.fpu softvfp
Expand Down
25 changes: 25 additions & 0 deletions src/runtime/micro/device/arm/stm32f746xx/utvm_timer.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,28 @@
/*
* 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.
*/

/*!
* Copyright (c) 2019 by Contributors
* \file utvm_timer.c
* \brief uTVM timer API definitions for STM32F746XX-series boards
*/

#ifdef __cplusplus
extern "C" {
#endif
Expand Down
39 changes: 39 additions & 0 deletions src/runtime/micro/device/host/utvm_init.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/*
* 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.
*/

/*!
* Copyright (c) 2019 by Contributors
* \file utvm_init.c
* \brief uTVM init definition for the host emulated device
*/

#ifdef __cplusplus
extern "C" {
#endif

#include "utvm_runtime.h"

void UTVMInit() {
// no init required for the host
UTVMMain();
}

#ifdef __cplusplus
} // TVM_EXTERN_C
#endif
28 changes: 24 additions & 4 deletions src/runtime/micro/device/host/utvm_timer.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,27 @@
/*
* 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.
*/

/*!
* Copyright (c) 2019 by Contributors
* \file utvm_timer.c
* \brief uTVM timer API stubs for the host emulated device
*/

#ifdef __cplusplus
extern "C" {
Expand All @@ -7,10 +31,6 @@ extern "C" {

// TODO(weberlo): use this? https://stackoverflow.com/questions/5141960/get-the-current-time-in-c

void UTVMInit() {
UTVMMain();
}

int32_t UTVMTimerStart() {
return 0;
}
Expand Down
6 changes: 3 additions & 3 deletions src/runtime/micro/host_driven/utvm_runtime.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@
* \file utvm_runtime.cc
* \brief uTVM runtime
*
* All function calls go through `UTVMMain`, which reads from the current
* `UTVMTask` and calls the appropriate function with the arguments from the
* task.
* All function calls go through the externally defined `UTVMInit`, which
* performs device-specific setup, then calls `UTVMMain`. `UTVMMain` then
* calls the function in `utvm_task` with the arguments from the task.
*
* Additionally included in this file are definitions for some of the most
* common functions used in the C runtime API.
Expand Down

0 comments on commit 1ca1cda

Please sign in to comment.