NNDK Release 2.8.1 (June 2016)

Discussion to talk about software related topics only.
Post Reply
User avatar
Forrest
Posts: 283
Joined: Wed Apr 23, 2008 10:05 am

NNDK Release 2.8.1 (June 2016)

Post by Forrest »

NNDK 2.8.1 beta release is now out and available for download on the NetBurner tools download page. Please report any issues in this thread or directly to support by submitting a new ticket at http://support.netburner.com.

Release 2.8.X is a major update and includes a dual IPv4/IPv6 TCP/IP stack and an updated GCC compiler.

Information

IPv4/IPv6
In order to implement the dual stack and provide the best compatibility with previous releases, IP addresses are now C++ objects. This will require minor code modifications in applications that stored IP addresses as unsigned long integers. See new dual stack help documentation located in /nburn/docs/IPv6/IPv6DualStackMode.pdf for further help in updating source code.

GCC5.2
GCC5.2 includes new optimizations which will help increase code speed and decrease size. It also enables additional warnings and errors to help debug your code. You may find that code that compiled and ran in GCC4.2 now has new warnings and/or error messages. These error messages will need to be addressed in order to run your application under GCC5.2.

NBEclipse
Applications built for NBEclipse 2.7.5 or below may get unexpected linker errors due to the new GCC5.2 compiler. This can be resolved by creating a new project and importing the source from the old project, much like importing an example. This will import the new settings required for build projects in GCC5.2

Code: Select all

# Release 2.8.1 (June 2016)
## New in this release
* Compiler/Linker
	* Added support for dead code stripping. This can reduce the size of your application by removing functions that are unused. Significant code size reductions when using c++ std library.
		* NBEclipse
			* Under project properties -> C/C++ compiler -> Optimization, enable -fdata-sections, -ffunction-sections
			* Under project properties -> C/C++ linker -> Optimization, enable --gc-sections
		* Makefile - Add EXTRALINKFLAGS := -Wl,--gc-sections
	* Added support for real time stack checking. This is disabled by default. It has a cost of 256 bytes at the end of the stack and slightly decreases task switch time
		* When stack is overflowed, a smarttrap will occur indicating the error and the line of code that caused the overflow
		* To enable stack checking
			* Uncomment #define UCOS_STACKOVERFLOW in /nburn/include/predef.h
			* Call EnableOSStackProtector() in your application
			* Add -fstack-check to compiler flags
				* NBEclipse - Under project properties -> C/C++ compiler -> Debugging, enable -fstack-check
				* Makefile  - Add EXTRACXXFLAGS := -fstack-check
	* Default compiler mode is now set to C++14, C11
* DNS
	* Added support for multiple DNS servers
* Examples
	* Added info to display DHCP leases and DNS servers to IPv6-ShowAddress
	* Added IPv6-DHCPv6 example to demonstrate DHCPv6 callback functions
	* Added new example to display all network interfaces
	* Added new MOD5441X EFFS-STD-SpeedTest example
* IPv6
	* Added ability for static addresses.
* SSL/TLS
	* Adding maximum session reuse lifetime to TLS.
* System
	* Added ability to report task monitor results via alternatives to taskmon utility
	* Added new Pins class functions:
		* toggle() - Set an output pin to the opposite state
		* readBack() - Read the current state of the pin without affecting direction
	* Smarttrap enabled by default on all standard stack platforms
	* Added OSDumpStack() function to output the current task's stack.

## Corrections in this release
* IPv6
	* Multiple DHCPv6 fixes. All users using DHCPv6 should upgrade
	* Fix routing issue for sending to multicast addresses while having non-auto configurable prefixes
	* Added router solicitation limit per RFC4861
* L2E
	* Fixed tcp_printf() hang.
* Make
	* Fixed error in library makefiles which would cause subdirectories to not get rebuilt when dependency are changed
* MCF5441X
	* Fixed Ethernet driver bug where Tx packets could fail to send promptly
	* Fixed CAN clock frequency error
	* Fixed DSPI baud-rate calculation (increased max baud-rate to 41.6M if you don't need 50% duty cycle)
	* Write performance improvements for MOD5441X parallel flash
* SB800EX
	* Fixed serial config error with transceiver configuration (232/422/485)
	* Fixed bug in IPSetup in which SB800EX could be set to print debug statements to an invalid port
* SSL/TLS
	* Fixed undefined virtual function in debug builds. clearAltNames()
	* Removed extra debug logging when DB_SSL was not enabled
	* Fixed SSL_POP3_InitalizeSession() to use port argument correctly
* System
	* Fixed pin_irq linking error which caused some examples to fail to build
	* Fixed vsprintf, vsnprintf to correct errors in c++ stream output
* TCP
	* Fixed packet leak in IPv4/IPv6 on networks that sent out-of-order packets retransmissions
* Tools
	* Compcode modified to ignore gaps < 16 bytes. Allows for alignment
* UDP
   * Fixed send failure when attempting to broadcast to a subnet
Forrest Stanley
Project Engineer
NetBurner, Inc

NetBurner Learn Articles: http://www.netburner.com/learn
ecasey
Posts: 164
Joined: Sat Mar 26, 2011 9:34 pm

Re: NNDK Release 2.8.1 (June 2016)

Post by ecasey »

Would it be possible for you to add the path: "${NBROOT}\gcc-m68k\m68k-unknown-elf\include\c++\5.2.0" to the NBINCLUDE variable in the nburn\MODxxxx\PROPERTIES files for the various modules in the next release?

Since 2.8.1 is fully C++, it would save us from having to add that to each new project, or when we re-compile for a different MOD.

Ed
User avatar
dciliske
Posts: 623
Joined: Mon Feb 06, 2012 9:37 am
Location: San Diego, CA
Contact:

Re: NNDK Release 2.8.1 (June 2016)

Post by dciliske »

Noted...
Dan Ciliske
Project Engineer
Netburner, Inc
KIMW107
Posts: 1
Joined: Tue Aug 04, 2015 12:51 pm

Re: NNDK Release 2.8.1 (June 2016)

Post by KIMW107 »

Hello,
After installing Version 2.8.1, sscanf of a float string returns 0. If I change the conversion to use the atof function all is fine.
example: float tscan;
sscanf(data.c_str(),"%f",&tscan);
float tatof = atof(data.c_str());
SysLog("String:{%s} ... atof: %g sscanf: %g\n",data.c_str(),tatof, tscan);
outputs:
String:{.00133} ... atof: 0.00133 sscanf:0

Any Clues?
ecasey
Posts: 164
Joined: Sat Mar 26, 2011 9:34 pm

Re: NNDK Release 2.8.1 (June 2016)

Post by ecasey »

It looks like a persistence problem with the data.c_str(). I saw this in passing a c_str() from an ostringstream object to a writestring function. It worked with 2.7.x, but not with 2.8.x. I worked around it by copying the c_str() to a array and passing that.
I believe that passing a c_str() pointer to a C function results in undefined behavior.
ecasey
Posts: 164
Joined: Sat Mar 26, 2011 9:34 pm

Re: NNDK Release 2.8.1 (June 2016)

Post by ecasey »

I am getting a segmentation error when imbuing a stringsteam with a custom locale.

Using: Release 2.81; MOD5270B on a MOD-DEV-70CR Rev: 1.93 board.

The code worked under Release 2.7.5

Here is the structure:

Code: Select all

struct my_numpunct : std::numpunct<char> {
	  std::string do_grouping() const {return "\03";}
	  char do_thousands_sep() const {return ',';}
	};
Here is the usage:

Code: Select all

std::locale loc (oss.getloc(),new my_numpunct);
	oss.imbue(loc);
Here is the Call Stack at the segmentation fault:

Code: Select all

NetBurner Standard Debugger (9/16/16 4:57 PM) (Suspended)	
	Thread [6 Prio( 45 ) :HTTP] (Suspended)	
	Thread [5 Prio( 38 ) :Esnd] (Suspended)	
	Thread [4 Prio( 39 ) :IP] (Suspended)	
	Thread [3 Prio( 40 ) :TCPD] (Suspended)	
	Thread [2 Prio( 50 ) :Main] (Suspended)	
	Thread [1 Prio( 63 ) :Idle] (Suspended: Signal 'SIGSEGV' received. Description: Segmentation fault.)	
		12 __cxxabiv1::__dynamic_cast() dyncast.cc:72 0x020788ec	
		11 <symbol is not available> 0x02115760	
		10 <symbol is not available> 0x021156e8	
		9 std::locale::_Impl::_Impl() locale.cc:290 0x020562c2	
		8 std::locale::facet::_M_cow_shim() cxx11-shim_facets.cc:792 0x02062116	
		7 std::locale::_Impl::_M_install_facet() locale.cc:385 0x02056466	
		6 std::locale::locale<my_numpunct>() locale_classes.tcc:50 0x02053b5a	
		5 UserMain() main.cpp:70 0x0205398e	
		4 callcusermain() cusermain.cpp:10 0x020281c2	
		3 UserMain() weakumain.cpp:11 0x020281aa	
		2 TopOfStackKillfunction() ucosmcfc.cpp:60 0x02007210	
		1 <symbol is not available> 0x00000000	

Frame 5: main.cpp:70 is the std::locale loc (oss.getloc(),new my_numpunct);
line.

Suggestions anyone?

Ed
ecasey
Posts: 164
Joined: Sat Mar 26, 2011 9:34 pm

Re: NNDK Release 2.8.1 (June 2016)

Post by ecasey »

One more thing:

Using: Release 2.81; MOD5270B on a MOD-DEV-70CR Rev: 1.93 board.

The following code to redirect the stdio to a UDP port that worked in Release 2.75 does not work in 2.81.
Nothing shows up on the UDP Terminal.

Code: Select all

	SerialClose( 0 );
    int portnum = 515;
    IPADDR ipaddr = AsciiToIp( "255.255.255.255");
    int fdSerial = CreateRxTxUdpSocket( ipaddr, portnum, portnum );
    ReplaceStdio( 0, fdSerial ); // stdin via UDP
    ReplaceStdio( 1, fdSerial ); // stdout via UDP
    ReplaceStdio( 2, fdSerial ); // stderr via UDP
Is there something that changed that I missed? I am running in the default #define IPV6 (1) mode.

Ed
KE5FX
Posts: 22
Joined: Tue Dec 10, 2019 11:17 pm

Re: NNDK Release 2.8.1 (June 2016)

Post by KE5FX »

KIMW107 wrote: Tue Aug 23, 2016 1:44 pm Hello,
After installing Version 2.8.1, sscanf of a float string returns 0. If I change the conversion to use the atof function all is fine.
example: float tscan;
sscanf(data.c_str(),"%f",&tscan);
float tatof = atof(data.c_str());
SysLog("String:{%s} ... atof: %g sscanf: %g\n",data.c_str(),tatof, tscan);
outputs:
String:{.00133} ... atof: 0.00133 sscanf:0

Any Clues?
Can confirm that sscanf() does not work with either floats (%f) or doubles ( %lf). It always writes 0.0 to the target variable, and subsequent fields in the format string also fail to parse.

Tested on MODM7AE70 with conventional char * strings under the latest 3.2 NNDK.

Any plans to fix this?
User avatar
Forrest
Posts: 283
Joined: Wed Apr 23, 2008 10:05 am

Re: NNDK Release 2.8.1 (June 2016)

Post by Forrest »

KE5FX wrote: Fri Feb 21, 2020 1:47 am Can confirm that sscanf() does not work with either floats (%f) or doubles ( %lf). It always writes 0.0 to the target variable, and subsequent fields in the format string also fail to parse.

Tested on MODM7AE70 with conventional char * strings under the latest 3.2 NNDK.

Any plans to fix this?
The 2.8.1 issues above were fixed a while ago. The scanf issue affect 3.2 and 2.9 has been resolved locally and will be in upcoming releases. In the meantime, see the following:

In Gcc8 (which came with release 2.9.X and 3.X, we use newlib-nano as our c library. This
library is designed for embedded devices, and reduces the size of many io functions. By
default, it disables float in both *scanf and *printf functions. In our library, we already override
printf function with our own custom printf, so the fact that they disabled printf float by default
has no affect. But for scanf, we use the provided function.

You can enable float in scanfs by either of the following:

Add
asm (".global _scanf_float");
anywhere in your source.

Add
EXTRALINKFLAGS += -u _scanf_float
to the makefile (or just pass "-u _scanf_float" to the linker gcc options)

Upon review of the differences between enabling or disabling scanf_float by default is about
1k in the flash image. Since the difference is pretty small (relative to available flash on our
platforms), in future releases, we are going to enable scanf_float by default and add a predef.h
option to disable this.
Forrest Stanley
Project Engineer
NetBurner, Inc

NetBurner Learn Articles: http://www.netburner.com/learn
KE5FX
Posts: 22
Joined: Tue Dec 10, 2019 11:17 pm

Re: NNDK Release 2.8.1 (June 2016)

Post by KE5FX »

Cool stuff, thanks very much!
Post Reply