-
Notifications
You must be signed in to change notification settings - Fork 440
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
Add arm-linux build for RPi2 and fix for nuttx build #125
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# Copyright 2015 Samsung Electronics Co., Ltd. | ||
# | ||
# Licensed 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(CMakeForceCompiler) | ||
|
||
set(CMAKE_SYSTEM_NAME Linux) | ||
set(CMAKE_SYSTEM_PROCESSOR armv7l-hf) | ||
|
||
set(EXTERNAL_CMAKE_C_COMPILER arm-linux-gnueabihf-gcc) | ||
set(EXTERNAL_CMAKE_CXX_COMPILER arm-linux-gnueabihf-g++) | ||
|
||
CMAKE_FORCE_C_COMPILER(${EXTERNAL_CMAKE_C_COMPILER} GNU) | ||
CMAKE_FORCE_CXX_COMPILER(${EXTERNAL_CMAKE_CXX_COMPILER} GNU) | ||
|
||
set(FLAGS_COMMON -mlittle-endian | ||
-mthumb | ||
-mfpu=vfpv3-d16 | ||
-D__LINUX__ | ||
-D__ARM__) | ||
|
||
foreach(FLAG ${FLAGS_COMMON}) | ||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${FLAG}") | ||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${FLAG}") | ||
endforeach() | ||
|
||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fpermissive") | ||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-exceptions") | ||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-rtti") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
/* Copyright 2015 Samsung Electronics Co., Ltd. | ||
* | ||
* Licensed 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 "iotjs_def.h" | ||
#include "iotjs_module_gpioctl.h" | ||
|
||
|
||
namespace iotjs { | ||
|
||
|
||
class GpioControlInst : public GpioControl { | ||
public: | ||
explicit GpioControlInst(JObject& jgpioctl); | ||
virtual int Initialize(void); | ||
virtual void Release(void); | ||
virtual int PinMode(uint32_t portpin); | ||
virtual int WritePin(uint32_t portpin, uint8_t data); | ||
virtual int ReadPin(uint32_t portpin, uint8_t* pdata); | ||
}; | ||
|
||
|
||
//----------------------------------------------------------------------------- | ||
|
||
GpioControl* GpioControl::Create(JObject& jgpioctl) | ||
{ | ||
return new GpioControlInst(jgpioctl); | ||
} | ||
|
||
|
||
GpioControlInst::GpioControlInst(JObject& jgpioctl) | ||
: GpioControl(jgpioctl) { | ||
} | ||
|
||
|
||
int GpioControlInst::Initialize(void) { | ||
if (_fd > 0 ) | ||
return IOTJS_GPIO_INUSE; | ||
|
||
_fd = 1; | ||
return _fd; | ||
} | ||
|
||
|
||
void GpioControlInst::Release(void) { | ||
_fd = 0; | ||
} | ||
|
||
|
||
int GpioControlInst::PinMode(uint32_t portpin) { | ||
if (_fd <= 0) | ||
return IOTJS_GPIO_NOTINITED; | ||
return 0; | ||
} | ||
|
||
|
||
int GpioControlInst::WritePin(uint32_t portpin, uint8_t data) { | ||
if (_fd <= 0) | ||
return IOTJS_GPIO_NOTINITED; | ||
return 0; | ||
} | ||
|
||
|
||
int GpioControlInst::ReadPin(uint32_t portpin, uint8_t* pdata) { | ||
if (_fd <= 0) | ||
return IOTJS_GPIO_NOTINITED; | ||
return 0; | ||
} | ||
|
||
|
||
} // namespace iotjs |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -136,6 +136,7 @@ def sys_machine(): | |
'tidy': True, | ||
'jerry-memstats': False, | ||
'checktest': True, | ||
'jerry-heaplimit': 81, | ||
} | ||
|
||
boolean_opts = ['buildlib', | ||
|
@@ -189,6 +190,9 @@ def opt_jerry_memstats(): | |
def opt_checktest(): | ||
return options['checktest'] | ||
|
||
def opt_jerry_heaplimit() : | ||
return options['jerry-heaplimit'] | ||
|
||
def parse_boolean_opt(name, arg): | ||
if arg.endswith(name): | ||
options[name] = False if arg.startswith('no') else True | ||
|
@@ -217,6 +221,8 @@ def parse_args(): | |
options[opt] = val | ||
elif opt == 'nuttx-home': | ||
options[opt] = val | ||
elif opt == 'jerry-heaplimit': | ||
options[opt] = val | ||
else: | ||
for opt_name in boolean_opts: | ||
if parse_boolean_opt(opt_name, opt): | ||
|
@@ -275,6 +281,8 @@ def build_libuv(): | |
# libuv is using gyp. run the system according to build target. | ||
if opt_target_arch() == 'arm' and opt_target_os() =='nuttx': | ||
check_run_cmd('./nuttx-configure', [opt_nuttx_home()]) | ||
elif opt_target_arch() == 'arm' and opt_target_os() =='linux': | ||
check_run_cmd('./armlinux-configure') | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Where is configure file? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah, ok I see this is for uv configuration. so the file should have been in the uv source tree. That good. |
||
else: | ||
check_run_cmd('./gyp_uv.py', ['-f', 'make']) | ||
|
||
|
@@ -378,12 +386,17 @@ def build_libjerry(): | |
jerry_cmake_opt.append('-DCMAKE_TOOLCHAIN_FILE=' + | ||
opt_cmake_toolchain_file()) | ||
|
||
|
||
# for nuttx build. | ||
if opt_target_arch() == 'arm' and opt_target_os() =='nuttx': | ||
# nuttx include path. | ||
jerry_cmake_opt.append('-DEXTERNAL_LIBC_INTERFACE=' + | ||
join_path([opt_nuttx_home(), 'include'])) | ||
jerry_cmake_opt.append('-DPLATFORM_EXT=NUTTX') | ||
jerry_cmake_opt.append('-DEXTERNAL_CMAKE_SYSTEM_PROCESSOR=arm') | ||
jerry_cmake_opt.append('-DEXTERNAL_MEM_HEAP_SIZE_KB=' + | ||
str(opt_jerry_heaplimit())) | ||
elif opt_target_arch() == 'arm' and opt_target_os() =='linux': | ||
jerry_cmake_opt.append('-DUSE_COMPILER_DEFAULT_LIBC=YES') | ||
|
||
# run cmake. | ||
# FIXME: Running cmake once cause a problem because cmake does not know | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"armv7l-hf" just tells us the cpu architecture, we could not determine that this is Raspberry PI2 ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, we need board dependent implementation. at this time there is only one arm-linux and it's RPi2, but later there might be others. I'm not sure about how to extend this right now. I hope you can give a way to do this.