Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for XC8-CC frontend #1

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[submodule "external/cmake-microchip"]
path = external/cmake-microchip
url = git://github.com/Elemecca/cmake-microchip.git
url = git://github.com/enbyted/cmake-microchip.git
9 changes: 9 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,15 @@ set(CMAKE_TOOLCHAIN_FILE external/cmake-microchip/toolchain.cmake)
# set the default MCU model
set(MICROCHIP_MCU PIC16F18857)

if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release)
endif()

project(xc8-cmake C)

set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wpedantic")
set(CMAKE_C_FLAGS_DEBUG "-g")
set(CMAKE_C_FLAGS_RELEASE "-O3")

add_subdirectory(hal/)
add_subdirectory(app/)
2 changes: 2 additions & 0 deletions app/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@ set(SOURCES

add_executable(app ${SOURCES})
target_include_directories(app PRIVATE include/)

target_link_libraries(app hal)
4 changes: 2 additions & 2 deletions app/src/main.c
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#include "configuration_bits.h"
#include <xc.h>
#include <hal/hal.h>

void main()
{
LATCbits.LATC1 = 0;
hal_init();

while(1)
{
Expand Down
2 changes: 1 addition & 1 deletion external/cmake-microchip
6 changes: 6 additions & 0 deletions hal/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
set(SOURCES
src/hal.c
)

add_library(hal ${SOURCES})
target_include_directories(hal PUBLIC include-public/)
6 changes: 6 additions & 0 deletions hal/include-public/hal/hal.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#ifndef __HAL_H__
#define __HAL_H__

void hal_init(void);

#endif
7 changes: 7 additions & 0 deletions hal/src/hal.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#include "hal/hal.h"
#include <xc.h>

void hal_init(void)
{
LATCbits.LATC1 = 0;
}