Skip to content
This repository has been archived by the owner on Dec 30, 2023. It is now read-only.

Commit

Permalink
Upgrade to latest SDK + script.ld patch
Browse files Browse the repository at this point in the history
  • Loading branch information
jleni committed Mar 14, 2018
1 parent 2a1c996 commit 3e1fbe8
Show file tree
Hide file tree
Showing 8 changed files with 46 additions and 48 deletions.
15 changes: 0 additions & 15 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,3 @@
#*******************************************************************************
#* (c) 2018 ZondaX GmbH
#*
#* 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.
#********************************************************************************
version: 2
jobs:
build:
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#* limitations under the License.
#********************************************************************************
cmake_minimum_required(VERSION 2.8)
project(ledger-ci-base)
project(ledger-cosmos)

set(CMAKE_CXX_STANDARD 11)
set(CMAKE_LEGACY_CYGWIN_WIN32 0) # Remove when CMake >= 2.8.4 is required
Expand Down
6 changes: 2 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# test-ci
# ledger-cosmos

[![CircleCI](https://circleci.com/gh/jleni/test-ci.svg?style=svg&circle-token=10bd6231dfc952ec8a49cda3299f9ecd3b717504)](https://circleci.com/gh/jleni/test-ci)

This is a basic example project using cmake / google test / CircleCI workflows / Bolos
[![CircleCI](https://circleci.com/gh/ZondaX/ledger-cosmos.svg?style=svg&circle-token=fdea2c93e42c201822ca76fe617258f3a5b3709a)](https://circleci.com/gh/ZondaX/ledger-cosmos)
2 changes: 1 addition & 1 deletion deps/nanos-secure-sdk
Submodule nanos-secure-sdk updated 71 files
+12 −3 Makefile.defines
+1 −2 Makefile.glyphs
+1 −60 Makefile.rules
+78 −0 Makefile.rules_generic
+522 −0 callgen.py
+1 −1 icon.py
+3 −2 include/bolos_target.h
+846 −0 include/core_cm0plus.h
+110 −0 include/core_sc000.h
+858 −304 include/cx.h
+316 −119 include/os.h
+3 −3 include/os_apilevel.h
+86 −24 include/os_io_seproxyhal.h
+22 −10 include/seproxyhal_protocol.h
+214 −511 include/syscalls.h
+0 −12 lib_stusb/STM32_USB_Device_Library/Class/CCID/inc/sc_itf.h
+61 −38 lib_stusb/STM32_USB_Device_Library/Class/CCID/inc/usbd_ccid_if.h
+107 −137 lib_stusb/STM32_USB_Device_Library/Class/CCID/src/usbd_ccid_cmd.c
+6 −3 lib_stusb/STM32_USB_Device_Library/Class/CCID/src/usbd_ccid_core.c
+221 −163 lib_stusb/STM32_USB_Device_Library/Class/CCID/src/usbd_ccid_if.c
+2 −2 lib_stusb/STM32_USB_Device_Library/Class/HID/Src/usbd_hid.c
+9 −0 lib_stusb/STM32_USB_Device_Library/Core/Inc/usbd_core.h
+4 −2 lib_stusb/STM32_USB_Device_Library/Core/Inc/usbd_def.h
+78 −43 lib_stusb/STM32_USB_Device_Library/Core/Src/usbd_core.c
+12 −12 lib_stusb/STM32_USB_Device_Library/Core/Src/usbd_ctlreq.c
+1 −1 lib_stusb/usbd_conf.h
+268 −0 lib_stusb_impl/u2f_impl.c
+1 −0 lib_stusb_impl/u2f_impl.h
+55 −0 lib_stusb_impl/u2f_io.c
+32 −0 lib_stusb_impl/usbd_ccid_impl.h
+0 −563 lib_stusb_impl/usbd_hid_impl.c
+18 −0 lib_stusb_impl/usbd_hid_impl.h
+913 −0 lib_stusb_impl/usbd_impl.c
+15 −4 lib_stusb_samples/Class/CCID/usbd_ccid_impl.c
+6 −6 lib_stusb_samples/Class/CCID/usbd_ccid_impl.h
+19 −10 lib_stusb_samples/Class/HID+FIDO/usbd_hid_impl.c
+3 −3 lib_stusb_samples/Class/HID+KBD/usbd_hid_impl.c
+4 −4 lib_stusb_samples/Class/HID/usbd_hid_impl.c
+37 −0 lib_u2f/include/u2f_io.h
+42 −0 lib_u2f/include/u2f_processing.h
+81 −0 lib_u2f/include/u2f_service.h
+33 −0 lib_u2f/include/u2f_timer.h
+95 −0 lib_u2f/include/u2f_transport.h
+341 −0 lib_u2f/src/u2f_transport.c
+96 −0 pycparser/__init__.py
+273 −0 pycparser/_ast_gen.py
+34 −0 pycparser/_build_tables.py
+188 −0 pycparser/_c_ast.cfg
+105 −0 pycparser/ast_transforms.py
+753 −0 pycparser/c_ast.py
+405 −0 pycparser/c_generator.py
+489 −0 pycparser/c_lexer.py
+1,692 −0 pycparser/c_parser.py
+5 −0 pycparser/ply/LICENSE
+4 −0 pycparser/ply/__init__.py
+898 −0 pycparser/ply/cpp.py
+133 −0 pycparser/ply/ctokens.py
+1,058 −0 pycparser/ply/lex.py
+3,276 −0 pycparser/ply/yacc.py
+55 −0 pycparser/plyparser.py
+18 −0 pycparser/portability.py
+149 −0 qrcode/include/qrcodegen.h
+769 −0 qrcode/src/qrcodegen.c
+10 −0 script.ld
+7 −0 script.ux.ld
+82 −42 src/os.c
+188 −46 src/os_io_seproxyhal.c
+1 −1 src/os_printf.c
+1 −1 src/pic.c
+1 −1 src/pic_internal.c
+981 −1,350 src/syscalls.c
3 changes: 0 additions & 3 deletions src/ledger/src/app_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,6 @@ void process_json(volatile uint32_t *tx, uint32_t rx)
os_memset((void *) &parsed_json, 0, sizeof(parsed_json_t));
ParseJson(&parsed_json, json_buffer);

//const char* sendMsgSample = "{\"_df\":\"3CAAA78D13BAE0\",\"_v\":{\"inputs\":[{\"address\":\"696E707574\",\"coins\":[{\"denom\":\"atom\",\"amount\":10}],\"sequence\":1}],\"outputs\":[{\"address\":\"6F7574707574\",\"coins\":[{\"denom\":\"atom\",\"amount\":10}]}]}}";
// ParseJson(&parsedMessage, sendMsgSample);

G_io_apdu_buffer[*tx + position++] = packageIndex;
G_io_apdu_buffer[*tx + position++] = packageCount;
G_io_apdu_buffer[*tx + position++] = json_buffer_write_pos;
Expand Down
4 changes: 2 additions & 2 deletions src/ledger/src/ui.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ static const bagl_element_t bagl_ui_idle_nanos[] =
},
{
{BAGL_LABELINE, 0x02, 0, 12, 128, 11, 0, 0, 0, 0xFFFFFF, 0x000000, UI_CENTER11PX, 0},
"Hello", 0, 0, 0, NULL, NULL, NULL,
"Tendermint", 0, 0, 0, NULL, NULL, NULL,
},
{
{BAGL_LABELINE, 0x02, 0, 23, 128, 11, 0, 0, 0, 0xFFFFFF, 0x000000, UI_CENTER11PX, 0},
"World", 0, 0, 0, NULL, NULL, NULL,
"Cosmos Demo", 0, 0, 0, NULL, NULL, NULL,
},
{
{BAGL_ICON, 0x00, 3, 12, 7, 7, 0, 0, 0, 0xFFFFFF, 0x000000, 0, BAGL_GLYPH_ICON_CROSS},
Expand Down
3 changes: 3 additions & 0 deletions tools/notes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
ledgerblue 0.1.17 manual install from github

> pip install git+https://github.com/LedgerHQ/blue-loader-python.git
59 changes: 37 additions & 22 deletions tools/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,15 @@
from ledgerblue.comm import getDongle
from ledgerblue.commException import CommException

try:
dongle = getDongle(True)
except CommException as e:
print(e)
quit()


# Sends json message to ledger preceded with a simple header made of 4 bytes written in hex ABCD, where:
# A is a fixed magic number 0x80
# B is an instruction code, here 0x01 (json message)
# C is an index of the sent chunk (json messages bigger than 250 characters are split into multiple chunks)
# D is a total number of chunks
def send(cmd, params=[]):
def send(dongle, cmd, params=[]):
chunk_size = 250
chunks = [params[x:x+chunk_size] for x in xrange(0, len(params), chunk_size)]
chunks = [params[x:x + chunk_size] for x in range(0, len(params), chunk_size)]

chunk_index = 0
for chunk in chunks:
Expand All @@ -29,7 +23,7 @@ def send(cmd, params=[]):
for p in chunk:
cmd_str = cmd_str + "{0:02x}".format(p)

print("Sending message: " + binascii.unhexlify(cmd_str))
print("Sending message: " + cmd_str)
dongle.exchange(binascii.unhexlify(cmd_str))

except CommException as e:
Expand All @@ -38,18 +32,39 @@ def send(cmd, params=[]):
print("COMMEXC: ", e)


# Use samples tool to produce different type of messages
# To create samples tool, run 'go build tools/samples.go'
import subprocess
json = subprocess.check_output(['./samples', '1', 'text'])
def get_test_message():
import subprocess

# Use samples tool to produce different type of messages
# To create samples tool, run 'go build tools/samples.go'

# json = subprocess.check_output(['./samples', '1', 'text'])

# Alternatively use this for a simple json message
#json = r"""{"_df":"3CAAA78D13BAE0","_v":{"inputs":[{"address":"696E707574","coins":[{"denom":"atom","amount":10}],"sequence":1}],"outputs":[{"address":"6F7574707574","coins":[{"denom":"atom","amount":10}]}]}}"""
# or this for more complicated one
json = r"""{"_df":"3CAAA78D13BAE0","_v":{"inputs":[{"address":"696E707574","coins":[{"denom":"atom","amount":10},{"denom":"bitcoint","amount":20}],"sequence":1},{"address":"616E6F74686572696E707574","coins":[{"denom":"atom","amount":50},{"denom":"bitcoint","amount":60},{"denom":"ethereum","amount":70}],"sequence":1}],"outputs":[{"address":"6F7574707574","coins":[{"denom":"atom","amount":10},{"denom":"bitcoint","amount":20}]},{"address":"616E6F746865726F7574707574","coins":[{"denom":"atom","amount":50},{"denom":"bitcoint","amount":60},{"denom":"ethereum","amount":70}]}]}}"""

return json


def main():
try:
dongle = getDongle(True)

json = get_test_message()

buffer = []
for j in json:
buffer.append(ord(j))

print("JSON Buffer Size: {}".format(len(buffer)))
send(dongle, 1, buffer)

except CommException as e:
print(e)
quit()

# Alternatively use this for a simple json message
# json = r"""{"_df":"3CAAA78D13BAE0","_v":{"inputs":[{"address":"696E707574","coins":[{"denom":"atom","amount":10}],"sequence":1}],"outputs":[{"address":"6F7574707574","coins":[{"denom":"atom","amount":10}]}]}}"""
# or this for more complicated one
# json = r"""{"_df":"3CAAA78D13BAE0","_v":{"inputs":[{"address":"696E707574","coins":[{"denom":"atom","amount":10},{"denom":"bitcoint","amount":20}],"sequence":1},{"address":"616E6F74686572696E707574","coins":[{"denom":"atom","amount":50},{"denom":"bitcoint","amount":60},{"denom":"ethereum","amount":70}],"sequence":1}],"outputs":[{"address":"6F7574707574","coins":[{"denom":"atom","amount":10},{"denom":"bitcoint","amount":20}]},{"address":"616E6F746865726F7574707574","coins":[{"denom":"atom","amount":50},{"denom":"bitcoint","amount":60},{"denom":"ethereum","amount":70}]}]}}"""

buffer = []
for j in json:
buffer.append(ord(j))
print(len(buffer))
send(1, buffer)
if __name__ == '__main__':
main()

0 comments on commit 3e1fbe8

Please sign in to comment.