Skip to content

Commit

Permalink
Merge branch 'bracz-optimize-tcp-socket' into bracz-hub-test-app
Browse files Browse the repository at this point in the history
* bracz-optimize-tcp-socket:
  Adds configuration options for TCP sockets, tuning for Hub app. (#759)
  Limits end to end buffering in gridconnect bridge. (#758)
  Ensures that an executor thread can not be created twice. (#757)
  Fixes build_bootloader_img.py. (#755)
  • Loading branch information
balazsracz committed Jan 2, 2024
2 parents 6e31c7e + 781184c commit e6b99c6
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ LDFLAGSEXTRA+= --specs=nano.specs
bootloader_bin/bootloader.bin: FORCE
$(MAKE) -C $(realpath bootloader_bin) bootloader.bin

payload.cxxout: bootloader_bin/bootloader.bin
payload.cxxout: bootloader_bin/bootloader.bin $(OPENMRNPATH)/bin/build_bootloader_img.py
$(OPENMRNPATH)/bin/build_bootloader_img.py -i bootloader_bin/bootloader.bin -o $@

.cxxout.o:
Expand Down
13 changes: 10 additions & 3 deletions bin/build_bootloader_img.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,9 @@ def print_c_array(file_out, name, payload):
ofs = 0
while True :
c = file_in.read(1)
if c == "" :
break
if len(c) == 0:
print("eof at", ofs)
break
bin_file.append(c)
ofs = ofs + 1
if options.maxsize is not None and ofs >= options.maxsize:
Expand All @@ -104,26 +105,32 @@ def print_c_array(file_out, name, payload):

outputblocks = []

print("Blocks:", end=" ")
for k, block in enumerate(blocks):
if k == 0:
b = Block()
b.ofs = 0
b.data = block
b.end_ofs = 0
outputblocks.append(b)
print("b", end="")
continue
if block.count('\0') == len(block): # all zeros
if block.count(b'\x00') == len(block): # all zeros
print("o", end="")
continue
if outputblocks[-1].end_ofs == k - 1:
outputblocks[-1].data += block
outputblocks[-1].end_ofs = k
print("x", end="")
else:
b = Block()
b.ofs = k
b.data = block
b.end_ofs = k
outputblocks.append(b)
print("b", end="")

print("")
segmenttable = ''
for b in outputblocks:
print_c_array(file_out, "payload_%d" % b.ofs, b.data);
Expand Down

0 comments on commit e6b99c6

Please sign in to comment.