i want to load my .data in flash instead of ram using code warrior eclipse IDE. here is the scenario.
.data :
{
*(.data);
} > ram AT> flash
now, all address are correctly generated (LMA and VMA) but code warrior load .data at VMA instead of LMA. how can i change this setting.
This should work:
.data LOAD(ADDR(flash)) :
{
*(.data)
} > ram
Related
Here is my test code:
test('should set correct constant', (){
expect(Stores.CurrentContext, 'currentContext');
});
but the picture above shows that the static constant code not tested. and why?
version infos:
Flutter 1.2.2-pre.3 • channel master • https://github.com/flutter/flutter.git
Framework • revision 67cf21577f (4 days ago) • 2019-02-14 23:17:16 -0800
Engine • revision 3757390fa4
Tools • Dart 2.1.2 (build 2.1.2-dev.0.0 0a7dcf17eb)
A coverage tool registers which code instructions was accessed by the running code.
Think of it as a recording of the memory addresses of "code sections" visited by the Program Counter register
of the processor stepping through program functions.
A static variable is reached through a data memory access, there are no code instructions involved:
a variable should be on the stack, on the heap or in a data section if it is a constant.
Consider this code:
import 'package:rxdart/rxdart.dart';
class Stores {
static const String Login = 'login';
static const String CurrentContext = 'currentContext';
}
class Store {
final name;
static var eMap = Map();
Store._internal(this.name); // DA:13
factory Store(String name) { // DA:15
if (eMap.containsKey(name)) { // DA:16
return eMap[name]; // DA:17
} else {
final store = Store._internal(name); // DA:19
eMap[name] = store; // DA:20
return store;
}
}
}
and this code run:
test('should set correct constant', (){
Store('currentContext');
Store('currentContext');
expect(Stores.CurrentContext, 'currentContext');
});
If you look at the raw output of icov you will notice that lines number of static variable is never reached, giving meaning to the model described above:
SF:lib/stores.dart
DA:13,1
DA:15,1
DA:16,2
DA:17,2
DA:19,1
DA:20,2
LF:6
LH:6
The visual reporting tool shows a 100% coverage:
If your reporting tool shows red lines over static variables it has to be considered a "false positive": survive with it or change the reporting tool.
I have some divice this is a prototye. In device was used MCU MT7620a. On board I have 32 MB RAM, and 64MB SPI Flash. I whant to install OpenWRT on this device, but I have problem with correct driver to this SPI flash, because driver m25p80 usually uses in linux handle size only to 32MB. System recognize memory as MT25QL512AB. So Do You have any idea what driver I have must use to good cooperation memory and MCU ?
I checked Table of Hardware available on site
http://wiki.openwrt.org/toh/start
In goal find something similar, but only I found is handle max to 32MB with m25p80. If I found some devices for example 64MB Flash or more, I can't use this idea using BuildRoot OpenWRT because all devices with 64MB Flash not has gives me information how to prepare Device Tree mt7620a.dts what concret driver is compatybile and etc.
Actualy device tree inode support flash size with 16MB it is look as below
palmbus#10000000 {
spi#b00 {
status = "okay";
m25p80#0 {
#address-cells = <1>;
#size-cells = <1>;
compatible = "en25q64";
reg = <0 0>;
linux,modalias = "m25p80", "en25q64";
spi-max-frequency = <10000000>;
partition#0 {
label = "u-boot";
reg = <0x0 0x30000>;
read-only;
};
partition#30000 {
label = "u-boot-env";
reg = <0x30000 0x10000>;
read-only;
};
factory: partition#40000 {
label = "factory";
reg = <0x40000 0x10000>;
read-only;
};
partition#50000 {
label = "firmware";
reg = <0x50000 0xfb0000>;
};
};
};
As You see was used m25p80
I have checked m25p80.c there is no support for your spi flash in it.
so I suggest you either add support manualy your self or take a look at this driver I came across
ralink_spi.c
let me know about your results.
I dont have that chip otherwise I would have tried it myself.
and resently there is added support for 32MB+ flash chips like m25q256fv etc.
Let me know
I am trying to run a sample code from the OpenNI 1.5 documentation.I have imported the library required XnCppWrapper.h so that I can use C++.The code has only one error on a particular variable "bshouldrun".I know that it should be declared as something but since I am new at this and the documentation does not contain anything above the main, I dont know what to declare it as..Please help!!
And thanks in advance.
#include <XnOpenNI.h>
#include <XnCppWrapper.h>
#include <stdio.h>
int main()
{
XnStatus nRetVal = XN_STATUS_OK;
xn::Context context;
// Initialize context object
nRetVal = context.Init();
// TODO: check error code
// Create a DepthGenerator node
xn::DepthGenerator depth;
nRetVal = depth.Create(context);
// TODO: check error code
// Make it start generating data
nRetVal = context.StartGeneratingAll();
// TODO: check error code
// Main loop
while (bShouldRun) //<-----------------------------**ERROR;bShouldRun Undefined**
{
// Wait for new data to be available
nRetVal = context.WaitOneUpdateAll(depth);
if (nRetVal != XN_STATUS_OK)
{
printf("Failed updating data: %s\n", xnGetStatusString(nRetVal));
continue;
}
// Take current depth map
const XnDepthPixel* pDepthMap = depth.GetDepthMap();
// TODO: process depth map
}
// Clean-up
context.Shutdown();
}
Here's what I did to run a sample from Visual Studio 2010 Express on Windows (8):
Opened the NiSimpleViewer.vcxproj VS2010 project from C:\Program Files (x86)\OpenNI\Samples\NiSimpleViewer
Edited OpenNI.rc to comment out #include "afxres.h" on line 10(might be missing this because I'm using Express version, not sure. Your machine might compile this fine/not complain about the missing header file)
Enabled Tools > Options > Debugging > Symbols > Microsoft Symbol Servers (to get past missing pdb files issue)
Optionally edit the SAMPLE_XML_PATH to "SamplesConfig.xml" rather than the default "../../../Data/SamplesConfig.xml", otherwise you need to run the sample executable from ..\Bin\Debug\NiSimpleViewer.exe by navigating to there rather than using the Ctrl+F5. A;so copy the SamplesConfig.xml file into your sample folder as you can see bellow
Here are a few images to illustrate some of the above steps:
You can also compile the NiHandTracker sample, which sounds closer to what you need.
So this explains the setup for OpenNI 1.5 which is what your question is about.
I've noticed your OpenNI 2 lib issue in the comments. It should be a matter of linking against SimpleHandTracker.lib which you can do via Project Properties (right-click project->select Properties) > Linker > Input > Additional Dependencies > Edit.
I don't have OpenNI2 setup on this machine, but assuming SimpleHandTracker.lib would be in OpenNI_INSTALL_FOLDER\Lib. Try a file search in case I might be wrong.
I'm having a problem in using XNA Math in a DLL I'm creating. I have a class that is in a DLL and is going to be exported. It has a member variable of type XMVECTOR. In the class constructor, I try to initialize the XMVECTOR. I get a Access Violation in reading from reading location 0x0000000000
The code runs something like this:
class DLLClass
{
public:
DLLClass(void);
~DLLClass(void);
protected:
XMVECTOR vect;
XMMATRIX matr;
}
DLLClass::DLLClass(void)
{
vect = XMLoadFloat3(&XMFLOAT3(0.0f, 0.0f, 0.0f)); //this is the line causing the access violation
}
Note that this class is in a DLL that is going to be exported. I do not know if this will make a difference by just some further info.
Also while I'm at it, I have another question:
I also get the warning: struct '_XMMATRIX' needs to have dll-interface to be used by clients of class 'DLLClass'
Is this fatal? If not, what does it mean and how can I get rid of it? Note this DLLClass is going to be exported and the "clients" of the DLLClass is probably going to use the variable 'matr'.
Any help would be appreciated.
EDIT: just some further info: I've debugged the code line by line and it seems that the error occurs when the return value of XMLoadFloat3 is assigned to the vect.
This code is only legal if you are building with x64 native -or- if you use __aligned_malloc to ensure the memory for all instances of DLLClass are 16-byte aligned. x86 (32-bit) malloc and new only provide 8-byte alignment by default. You can 'get lucky' but it's not stable.
class DLLClass
{
public:
DLLClass(void);
~DLLClass(void);
protected:
XMVECTOR vect;
XMMATRIX matr;
}
See DirectXMath Programming Guide, Getting Started
You have three choices:
Ensure DLLClass is always 16-byte aligned
Use XMFLOAT4 and XMFLOAT4X4 instead and do explicit load/stores
Use the SimpleMath wrapper types in DirectX Tool Kit instead which handle the loads/stores for you.
You shouldn't take the address of an anonymous variable:
vect = XMLoadFloat3(&XMFLOAT3(0.0f, 0.0f, 0.0f));
You need
XMFLOAT3 foo(0.0f, 0.0f, 0.0f);
vect = XMLoadFloat3(&foo);
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
It is useful to have skeleton or template files that you can just copy and use as a basis for a new script or app.
For example, I use the following ones (emacs with the auto-insert module automatically opens a copy of the appropriate skeleton file when I create a new file).
Perl:
#!/usr/bin/perl -w
use strict;
use Getopt::Long;
my $verbose = 1;
GetOptions("verbose!" => \$verbose
) or die("options error");
C++:
#include <iostream>
#include <stdexcept>
int main(int argc, char** argv){
try{
}
catch(std::exception& e){
std::cerr << e.what() << std::endl;
return EXIT_FAILURE;
}
return EXIT_SUCCESS;
}
Arguably, one could include basic code for boost::program_options etc.
What are your favorite skeleton files?
The only skeleton file I have is for LaTeX.
\documentclass{article}
%\documentclass[11pt]{amsart}
\usepackage[dvips]{graphicx}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{amsthm}
\usepackage{cancel}
\oddsidemargin0cm
\topmargin-1cm
\textwidth16.5cm
\textheight23.5cm
\parskip1ex
\parindent0ex
\begin{document}
\title{ ... }
\author{ ... }
\date{ ... }
\maketitle
\end{document}
Obviously I use this for writing math papers.
Otherwise, I always start from scratch. There's no programming language I can think of where the requisite infrastructure is more than you can keep around in your brain or take longer than 20 seconds to type out.
My Perl templates look like this:
If I am opening a .pm module:
use MooseX::Declare;
class What::Ever {
};
1;
Or, if not on a MooseX::Declare project:
package What::Ever;
use Moose;
1;
If it's a .pl file:
#!/usr/bin/env perl
use strict;
use warnings;
use feature ':5.10';
Since I use autoinsert.el, I also have it ask me if I want to use FindBin; if so:
#!/usr/bin/env perl
use strict;
use warnings;
use feature ':5.10';
use FindBin qw($Bin);
use lib "$Bin/../lib";
The necessary emacs code is in my elisp repository at http://github.com/jrockway/elisp/blob/fd5d73530a117a13ddcde92bc1c22aba1bfde1f0/_local/auto-inserts.el.
Finally, I think you will prefer MooseX::Getopt to plain Getopt. It is a much more maintainable approach to writing "one-off" scripts. (The next few lines go something like:
use My::Script; # that's why we did the "use lib" thing
My::Script->new_with_options->run; # this parses the command line, creates a new object, and runs the script
All the important code goes in a class that can be unit tested, glued to a web app, etc.)
In visual studio, they're called Project files; my current favorite is Windows Application ;-)
Java
package edu.vt;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
public class Template
{
private Log log = LogFactory.getLog(getClass());
/* Constructors
***************************************************************************/
public Template()
{
}
/* Accessors/Mutators
***************************************************************************/
/* Local Methods
***************************************************************************/
}
and
package testing.edu.vt;
import edu.vt.Template;
import junit.framework.TestCase;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
public class TemplateTestCase extends TestCase
{
private final Log log = LogFactory.getLog(getClass());
public TemplateTestCase(final String name)
{
super(name);
}
protected void setUp()
{
}
protected void tearDown()
{
}
public void testLifeCycle() throws Exception
{
assertTrue(true);
}
}
Python is simple, but it still helps if you import things with shortcut names, for example:
import sys
import numpy as np
import pylab as pyb
import matplotlib.pyplot as plt
import matplotlib as mpl
But just don't do: import skynet.
Bourne Shell
#!/bin/sh
usage() {
cat <<EOF
$0 <cmd>
cmd:
samplecmd
EOF
}
cmd=${1}
shift
case ${cmd} in
samplecmd)
arg1=${arg1:-${1}} # arg list takes precedence over env var
if [ "x${arg1}" = "x" ] ; then
usage
fi
samplecmd ${arg1}
;;
*)
usage
;;
esac
I like to make little helper scripts like this to document commands I type in the shell.
When I'm writing code that will be OSS I have a simple boiler plate template that I can key in the license and URL to the license text. The boiler plate has author details, and other crap hard coded.
For commercial dev I have a boiler plate with company information, and standard copyright notices in it.
I don't keep any standard skeletons because I've found I just cut out the content and added my own anyway. Most cases are different enough that changing the skeleton to match takes as long as bashing it out by hand.