running file diff on two files on Mac - diff

Im comparing to files, but my understanding is that + signifies addition and - symbols deletion. The new file has a typo:
if (KEY_STATUS.spacr) {
The why is it represented by -. It should be +, right ? When I run diff -u game_new.js game_old.js:
--- game_new.js 2018-06-12 02:03:32.000000000 -0700
+++ game_old.js 2018-06-12 02:03:22.000000000 -0700
## -4,9 +4,9 ##
//
KEY_CODES = {
- 13: 'enter',
32: 'space',
37: 'left',
+ 38: 'up',
39: 'right',
40: 'down',
70: 'f',
## -392,7 +392,7 ##
this.vel.rot = 0;
}
- if (KEY_STATUS.spacr) {
+ if (KEY_STATUS.up) {
var rad = ((this.rot-90) * Math.PI)/180;
this.acc.x = 0.5 * Math.cos(rad);
this.acc.y = 0.5 * Math.sin(rad);
## -406,7 +406,7 ##
if (this.delayBeforeBullet > 0) {
this.delayBeforeBullet -= delta;
}
- if (KEY_STATUS.enter) {
+ if (KEY_STATUS.space) {
if (this.delayBeforeBullet <= 0) {
this.delayBeforeBullet = 10;
for (var i = 0; i < this.bullets.length; i++) {
## -919,7 +919,7 ##
waiting: function () {
Text.renderText(ipad ? 'Touch Sreen to Start' : 'Press Space to Start', 36, Game.canvasWidth/2 - 270, Game.canvasHeight/2);
if (KEY_STATUS.space || window.gameStart) {
- KEY_STATUS.space = false; // hack so we don't move right away
+ KEY_STATUS.space = false; // hack so we don't shoot right away
window.gameStart = false;
this.state = 'start';
}

I believe that when you run:
diff -u game_new.js game_old.js
The changes coming from the file on the left are interpreted as being the source, and marked with a minus, while the changes coming from the file on the right are treated as the destination, and marked with a plus.
If you want the - and + labels to appear as you want, then run diff with the files in the reverse order:
diff -u game_old.js game_new.js

Related

Protractor need to break from For LOOP when if is executed

Can anyone Please Help me in this in the below code, my requirement is once If is true, I should come out from For loop
===================================================
for (i = 0; i < 50; i++) {
element(By.xpath("//*[text() = '" + InvoiceREFnumberCompany + "']")).isPresent().then(function(result) {
if (result )
{
element(By.xpath("//*[text() = '" + InvoiceREFnumberCompany + "']")).click();
break;
}
else
{
obj1.ClickOnRefreshButton.click();
}
});
}
Output
Failures:
NPOInvoice-Fire -- NPO Fire Collabrate with PTC user
Message:
[31m Failed: Illegal break statement[0m
Stack:
SyntaxError: Illegal break statement

Using ecpg with postgresql, unable to parse boolean field

I am trying to retrieve records from a PostgreSQL
I use the following script to create the database, table and fill it up with some records:
psql << "EOF"
CREATE DATABASE todo;
\c todo
CREATE TABLE items
(
id serial PRIMARY KEY,
task VARCHAR(40) NOT NULL,
complete boolean
);
INSERT INTO items (id, task, complete) VALUES (1, 'task1', true);
INSERT INTO items (id, task, complete) VALUES (2, 'task2', true);
INSERT INTO items (id, task, complete) VALUES (3, 'task3', true);
INSERT INTO items (id, task, complete) VALUES (4, 'task4', true);
INSERT INTO items (id, task, complete) VALUES (5, 'task5', false);
INSERT INTO items (id, task, complete) VALUES (6, 'task6', false);
EOF
I use a) structure as well as b) individual variables to handle the problem. Method a) could not parse boolean field complete. Here is the program:
#include <stdio.h>
#include <stdlib.h>
#include <ecpglib.h>
int
main(void)
{
#if ENABLE_DEBUG
ECPGdebug(1, stderr);
#endif
EXEC SQL WHENEVER SQLERROR sqlprint;
EXEC SQL BEGIN DECLARE SECTION;
/* Use structure as host variable */
typedef struct {
int id;
char task[40];
bool complete;
} item_t;
item_t item;
/* Use individual variables as host variables */
int id;
char task[40];
bool complete;
EXEC SQL END DECLARE SECTION;
memset(&item, 0, sizeof(item_t));
EXEC SQL CONNECT TO todo;
/*
* Use structure as host variable
*/
EXEC SQL DECLARE cur1 CURSOR FOR
SELECT id, task, complete
FROM items;
EXEC SQL OPEN cur1;
printf("sizeof(item_t) = %ld\n", sizeof(item));
printf(" sizeof(item.int) = %ld\n", sizeof(item.id));
printf(" sizeof(item.task) = %ld\n", sizeof(item.task));
printf(" sizeof(item.complete) = %ld\n", sizeof(item.complete));
printf("\n"
"Using structure variable\n"
"------------------------\n");
EXEC SQL WHENEVER NOT FOUND DO BREAK;
while (1)
{
EXEC SQL FETCH FROM cur1 INTO :item;
printf("id=%d, task=%s, complete=%d\n\n",
item.id, item.task, item.complete);
}
EXEC SQL CLOSE cur1;
/*
* Use individual variables as host variables
*/
EXEC SQL DECLARE cur2 CURSOR FOR
SELECT id, task, complete
FROM items;
EXEC SQL OPEN cur2;
printf("sizeof(int) = %ld\n", sizeof(id));
printf("sizeof(task) = %ld\n", sizeof(task));
printf("sizeof(complete) = %ld\n", sizeof(complete));
printf("\n"
"Using individual variables\n"
"--------------------------\n");
EXEC SQL WHENEVER NOT FOUND DO BREAK;
while (1)
{
EXEC SQL FETCH FROM cur2 INTO :id, :task, :complete;
printf("id=%d, task=%s, complete=%d\n",
id, task, complete);
}
EXEC SQL CLOSE cur2;
EXEC SQL DISCONNECT ALL;
return 0;
}
The outputs:
sizeof(item_t) = 48
sizeof(item.int) = 4
sizeof(item.task) = 40
sizeof(item.complete) = 1
Using structure variable
------------------------
SQL error: could not convert boolean value: size mismatch, on line 80
id=1, task=task1, complete=0
SQL error: could not convert boolean value: size mismatch, on line 80
id=2, task=task2, complete=0
SQL error: could not convert boolean value: size mismatch, on line 80
id=3, task=task3, complete=0
SQL error: could not convert boolean value: size mismatch, on line 80
id=4, task=task4, complete=0
SQL error: could not convert boolean value: size mismatch, on line 80
id=5, task=task5, complete=0
SQL error: could not convert boolean value: size mismatch, on line 80
id=6, task=task6, complete=0
sizeof(int) = 4
sizeof(task) = 40
sizeof(complete) = 1
Using individual variables
--------------------------
id=1, task=task1, complete=1
id=2, task=task2, complete=1
id=3, task=task3, complete=1
id=4, task=task4, complete=1
id=5, task=task5, complete=0
id=6, task=task6, complete=0
The problem was raised as a bug and fixed by Michael Meskes. If you need the solution, apply the fix yourself fist.
diff --git a/src/interfaces/ecpg/ecpglib/data.c b/src/interfaces/ecpg/ecpglib/data.c
index 8d36484..82ab4aa 100644
--- a/src/interfaces/ecpg/ecpglib/data.c
+++ b/src/interfaces/ecpg/ecpglib/data.c
## -423,27 +423,13 ## ecpg_get_data(const PGresult *results, int act_tuple, int act_field, int lineno,
case ECPGt_bool:
if (pval[0] == 'f' && pval[1] == '\0')
{
- if (offset == sizeof(char))
- *((char *) (var + offset * act_tuple)) = false;
- else if (offset == sizeof(int))
- *((int *) (var + offset * act_tuple)) = false;
- else
- ecpg_raise(lineno, ECPG_CONVERT_BOOL,
- ECPG_SQLSTATE_DATATYPE_MISMATCH,
- NULL);
+ *((bool *) (var + offset * act_tuple)) = false;
pval++;
break;
}
else if (pval[0] == 't' && pval[1] == '\0')
{
- if (offset == sizeof(char))
- *((char *) (var + offset * act_tuple)) = true;
- else if (offset == sizeof(int))
- *((int *) (var + offset * act_tuple)) = true;
- else
- ecpg_raise(lineno, ECPG_CONVERT_BOOL,
- ECPG_SQLSTATE_DATATYPE_MISMATCH,
- NULL);
+ *((bool *) (var + offset * act_tuple)) = true;
pval++;
break;
}
diff --git a/src/interfaces/ecpg/ecpglib/execute.c b/src/interfaces/ecpg/ecpglib/execute.c
index 9e40f41..3b6eedb 100644
--- a/src/interfaces/ecpg/ecpglib/execute.c
+++ b/src/interfaces/ecpg/ecpglib/execute.c
## -752,18 +752,9 ## ecpg_store_input(const int lineno, const bool force_indicator, const struct vari
{
strcpy(mallocedval, "{");
- if (var->offset == sizeof(char))
- for (element = 0; element < asize; element++)
- sprintf(mallocedval + strlen(mallocedval), "%c,", (((char *) var->value)[element]) ? 't' : 'f');
+ for (element = 0; element < asize; element++)
+ sprintf(mallocedval + strlen(mallocedval), "%c,", (((bool *) var->value)[element]) ? 't' : 'f');
- /*
- * this is necessary since sizeof(C++'s bool)==sizeof(int)
- */
- else if (var->offset == sizeof(int))
- for (element = 0; element < asize; element++)
- sprintf(mallocedval + strlen(mallocedval), "%c,", (((int *) var->value)[element]) ? 't' : 'f');
- else
- ecpg_raise(lineno, ECPG_CONVERT_BOOL, ECPG_SQLSTATE_DATATYPE_MISMATCH, NULL);
strcpy(mallocedval + strlen(mallocedval) - 1, "}");
}

For Linux 3.10 what what changes do I need to make to get netmap/virtio_net working?

The netmap/virtio_net driver didn't work (Linux 3.10 kernel). There were two problems.
On the 3.10.60 kernel from kernel.org, the patch to virtio_net.c didn't
work, one part of the patch was rejected. This is easily fixed.
More serious, was that the virtio initialization code didn't work, nor
did the packet receive code. The basic problem was failure to initialize
the indices properly and failure to maintain a 1 slot separation between
head/tail indices. (Same problem 2 locations in the code.)
This problem is easily seen by creating a KVM guest with a
netmap/virtio_net driver, and simply pinging the guest from the host.
The receive traffic can easily be monitored using the pkt-gen tool on
the guest.
The first 255 pings will work fine, when the index hits 255, then the
packet receive will fail, and will continue to fail every time on slot 255.
I've included patches for both problems in the hopes that the source code
will be updated and others won't have to find these problems.
First virtio_netmap_3.10.60.patch:
# patch is the whole netmap virtio driver patch for 3.10.60 (from
# kernel.org), and it applies correctly.
#
Index: linux-3.10.60/drivers/net/virtio_net.c
===================================================================
--- linux-3.10.60.orig/drivers/net/virtio_net.c 2014-11-14 11:48:23.000000000 -0500
+++ linux-3.10.60/drivers/net/virtio_net.c 2014-11-21 12:54:29.751760095 -0500
## -131,6 +131,10 ##
struct notifier_block nb;
};
+#if defined(CONFIG_NETMAP) || defined(CONFIG_NETMAP_MODULE)
+#include <virtio_netmap.h>
+#endif
+
struct skb_vnet_hdr {
union {
struct virtio_net_hdr hdr;
## -210,6 +214,10 ##
/* Suppress further interrupts. */
virtqueue_disable_cb(vq);
+#ifdef DEV_NETMAP
+ if (netmap_tx_irq(vi->dev, vq2txq(vq)))
+ return;
+#endif
/* We were probably waiting for more output buffers. */
netif_wake_subqueue(vi->dev, vq2txq(vq));
}
## -646,7 +654,16 ##
struct virtnet_info *vi = rq->vq->vdev->priv;
void *buf;
unsigned int r, len, received = 0;
+#ifdef DEV_NETMAP
+ int work_done = 0;
+
+ if (netmap_rx_irq(vi->dev, vq2rxq(rq->vq), &work_done)) {
+ napi_complete(napi);
+ ND("called netmap_rx_irq");
+ return 1;
+ }
+#endif
again:
while (received < budget &&
(buf = virtqueue_get_buf(rq->vq, &len)) != NULL) {
## -679,6 +696,16 ##
{
struct virtnet_info *vi = netdev_priv(dev);
int i;
+#ifdef DEV_NETMAP
+ int ok = virtio_netmap_init_buffers(vi);
+
+ netmap_enable_all_rings(dev);
+ if (ok) {
+ for (i = 0; i < vi->max_queue_pairs; i++)
+ virtnet_napi_enable(&vi->rq[i]);
+ return 0;
+ }
+#endif
for (i = 0; i < vi->max_queue_pairs; i++) {
if (i < vi->curr_queue_pairs)
## -972,6 +999,9 ##
struct virtnet_info *vi = netdev_priv(dev);
int i;
+#ifdef DEV_NETMAP
+ netmap_disable_all_rings(dev);
+#endif
/* Make sure refill_work doesn't re-enable napi! */
cancel_delayed_work_sync(&vi->refill);
## -1644,6 +1674,10 ##
goto free_recv_bufs;
}
+#ifdef DEV_NETMAP
+ virtio_netmap_attach(vi);
+#endif
+
/* Assume link up if device can't report link status,
otherwise get link status from config. */
if (virtio_has_feature(vi->vdev, VIRTIO_NET_F_STATUS)) {
## -1690,6 +1724,9 ##
{
struct virtnet_info *vi = vdev->priv;
+#ifdef DEV_NETMAP
+ netmap_detach(vi->dev);
+#endif
unregister_hotcpu_notifier(&vi->nb);
/* Prevent config work handler from accessing the device. */
Next is the virtio_netmap.patch
# There is a problem with the initialization, and during read packet with
# control of the indices .
#
# This problem is easily seen by building a KVM netmap/virtio_net driver, and
# simply pinging it (host pings KVM guest). All goes well, until ring buffer
# reaches index 255, and no packet is actually received. This will fix that
# problem and resulted in a working driver.
#
Index: b/LINUX/virtio_netmap.h
===================================================================
--- a/LINUX/virtio_netmap.h 2014-11-21 16:26:03.951278021 -0500
+++ b/LINUX/virtio_netmap.h 2014-11-21 16:26:25.451386665 -0500
## -398,8 +398,8 ##
* Second part: skip past packets that userspace has released.
*/
nm_i = kring->nr_hwcur; /* netmap ring index */
- if (nm_i != head) {
- for (n = 0; nm_i != head; n++) {
+ if (nm_next(nm_i, lim) != head) {
+ for (n = 0; nm_next(nm_i, lim) != head; n++) {
struct netmap_slot *slot = &ring->slot[nm_i];
void *addr = NMB(slot);
int err;
## -421,7 +421,7 ##
virtqueue_kick(vq);
nm_i = nm_next(nm_i, lim);
}
- kring->nr_hwcur = head;
+ kring->nr_hwcur = nm_i;
}
/* We have finished processing used RX buffers, so we have to tell
## -454,6 +454,7 ##
for (r = 0; r < na->num_rx_rings; r++) {
COMPAT_DECL_SG
struct netmap_ring *ring = na->rx_rings[r].ring;
+ struct netmap_kring *kring = &na->rx_rings[r];
struct virtqueue *vq = GET_RX_VQ(vi, r);
struct scatterlist *sg = GET_RX_SG(vi, r);
struct netmap_slot* slot;
## -485,6 +486,7 ##
if (VQ_FULL(vq, err))
break;
}
+ kring->nr_hwcur = i;
D("added %d inbufs on queue %d", i, r);
virtqueue_kick(vq);
}

LSP packet modify

anybody care to share some insights on how to use LSP for packet modifying ?
I am using the non IFS subtype and I can see how (pseudo?) packets first enter WSPRecv. But how do I modify them ? My inquiry is about one single HTTP response that causes WSPRecv to be called 3 times :((. I need to modify several parts of this response, but since it comes in 3 slices, it is pretty hard to modify it accordingly. And, maybe on other machines or under different conditions (such as high traffic) there would only be one sole WSPRecv call, or maybe 10 calls. What is the best way to work arround this (please no NDIS :D), and how to properly change the buffer (lpBuffers->buf) by increasing it ?
int WSPAPI
WSPRecv(
SOCKET s,
LPWSABUF lpBuffers,
DWORD dwBufferCount,
LPDWORD lpNumberOfBytesRecvd,
LPDWORD lpFlags,
LPWSAOVERLAPPED lpOverlapped,
LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine,
LPWSATHREADID lpThreadId,
LPINT lpErrno
)
{
LPWSAOVERLAPPEDPLUS ProviderOverlapped = NULL;
SOCK_INFO *SocketContext = NULL;
int ret = SOCKET_ERROR;
*lpErrno = NO_ERROR;
//
// Find our provider socket corresponding to this one
//
SocketContext = FindAndRefSocketContext(s, lpErrno);
if ( NULL == SocketContext )
{
dbgprint( "WSPRecv: FindAndRefSocketContext failed!" );
goto cleanup;
}
//
// Check for overlapped I/O
//
if ( NULL != lpOverlapped )
{
/*bla bla .. not interesting in my case*/
}
else
{
ASSERT( SocketContext->Provider->NextProcTable.lpWSPRecv );
SetBlockingProvider(SocketContext->Provider);
ret = SocketContext->Provider->NextProcTable.lpWSPRecv(
SocketContext->ProviderSocket,
lpBuffers,
dwBufferCount,
lpNumberOfBytesRecvd,
lpFlags,
lpOverlapped,
lpCompletionRoutine,
lpThreadId,
lpErrno);
SetBlockingProvider(NULL);
//is this the place to modify packet length and contents ?
if (strstr(lpBuffers->buf, "var mapObj = null;"))
{
int nLen = strlen(lpBuffers->buf) + 200;
/*CHAR *szNewBuf = new CHAR[];
CHAR *pIndex;
pIndex = strstr(lpBuffers->buf, "var mapObj = null;");
nLen = strlen(strncpy(szNewBuf, lpBuffers->buf, (pIndex - lpBuffers->buf) * sizeof (CHAR)));
nLen = strlen(strncpy(szNewBuf + nLen * sizeof(CHAR), "var com = null;\r\n", 17 * sizeof(CHAR)));
pIndex += 18 * sizeof(CHAR);
nLen = strlen(strncpy(szNewBuf + nLen * sizeof(CHAR), pIndex, 1330 * sizeof (CHAR)));
nLen = strlen(strncpy(szNewBuf + nLen * sizeof(CHAR), "if (com == null)\r\n" \
"com = new ActiveXObject(\"InterCommJS.Gateway\");\r\n" \
"com.lat = latitude;\r\n" \
"com.lon = longitude;\r\n}", 111 * sizeof (CHAR)));
pIndex = strstr(szNewBuf, "Content-Length:");
pIndex += 16 * sizeof(CHAR);
strncpy(pIndex, "1465", 4 * sizeof(CHAR));
lpBuffers->buf = szNewBuf;
lpBuffers->len += 128;*/
}
if ( SOCKET_ERROR != ret )
{
SocketContext->BytesRecv += *lpNumberOfBytesRecvd;
}
}
cleanup:
if ( NULL != SocketContext )
DerefSocketContext( SocketContext, lpErrno );
return ret;
}
Thank you
my comment worked out. http response headers / request turned out to end in \r\n\r\n.

How to run a .patch file with several diffs inside

I have never used a .patch file but I need to run SEGGER's FreeRTOSV10_Core.patch file.
The shown file can be found in the SystemView Zip Archive.
diff -rupN org/Source/include/FreeRTOS.h new/Source/include/FreeRTOS.h
--- org/Source/include/FreeRTOS.h 2017-11-28 13:48:34.000000000 -0800
+++ new/Source/include/FreeRTOS.h 2017-12-11 00:54:49.522222000 -0800
## -157,6 +157,10 ## extern "C" {
#define INCLUDE_uxTaskGetStackHighWaterMark 0
#endif
+#ifndef INCLUDE_pxTaskGetStackStart
+ #define INCLUDE_pxTaskGetStackStart 0
+#endif
+
#ifndef INCLUDE_eTaskGetState
#define INCLUDE_eTaskGetState 0
#endif
## -393,6 +397,23 ## extern "C" {
#define tracePOST_MOVED_TASK_TO_READY_STATE( pxTCB )
#endif
+#ifndef traceREADDED_TASK_TO_READY_STATE
+ #define traceREADDED_TASK_TO_READY_STATE( pxTCB ) traceMOVED_TASK_TO_READY_STATE( pxTCB )
+#endif
+
+#ifndef traceMOVED_TASK_TO_DELAYED_LIST
+ #define traceMOVED_TASK_TO_DELAYED_LIST()
+#endif
+
+#ifndef traceMOVED_TASK_TO_OVERFLOW_DELAYED_LIST
+ #define traceMOVED_TASK_TO_OVERFLOW_DELAYED_LIST()
+#endif
+
+#ifndef traceMOVED_TASK_TO_SUSPENDED_LIST
+ #define traceMOVED_TASK_TO_SUSPENDED_LIST( pxTCB )
+#endif
+
+
#ifndef traceQUEUE_CREATE
#define traceQUEUE_CREATE( pxNewQueue )
#endif
## -637,6 +658,18 ## extern "C" {
#define traceTASK_NOTIFY_GIVE_FROM_ISR()
#endif
+#ifndef traceISR_EXIT_TO_SCHEDULER
+ #define traceISR_EXIT_TO_SCHEDULER()
+#endif
+
+#ifndef traceISR_EXIT
+ #define traceISR_EXIT()
+#endif
+
+#ifndef traceISR_ENTER
+ #define traceISR_ENTER()
+#endif
+
#ifndef traceSTREAM_BUFFER_CREATE_FAILED
#define traceSTREAM_BUFFER_CREATE_FAILED( xIsMessageBuffer )
#endif
diff -rupN org/Source/include/task.h new/Source/include/task.h
--- org/Source/include/task.h 2017-11-28 13:48:34.000000000 -0800
+++ new/Source/include/task.h 2017-12-11 00:56:29.783423000 -0800
## -1422,6 +1422,25 ## TaskHandle_t xTaskGetHandle( const char
*/
UBaseType_t uxTaskGetStackHighWaterMark( TaskHandle_t xTask ) PRIVILEGED_FUNCTION;
+/**
+ * task.h
+ * <PRE>uint8_t* pxTaskGetStackStart( TaskHandle_t xTask);</PRE>
+ *
+ * INCLUDE_pxTaskGetStackStart must be set to 1 in FreeRTOSConfig.h for
+ * this function to be available.
+ *
+ * Returns the start of the stack associated with xTask. That is,
+ * the highest stack memory address on architectures where the stack grows down
+ * from high memory, and the lowest memory address on architectures where the
+ * stack grows up from low memory.
+ *
+ * #param xTask Handle of the task associated with the stack returned.
+ * Set xTask to NULL to return the stack of the calling task.
+ *
+ * #return A pointer to the start of the stack.
+ */
+uint8_t* pxTaskGetStackStart( TaskHandle_t xTask) PRIVILEGED_FUNCTION;
+
/* When using trace macros it is sometimes necessary to include task.h before
FreeRTOS.h. When this is done TaskHookFunction_t will not yet have been defined,
so the following two prototypes will cause a compilation error. This can be
diff -rupN org/Source/portable/GCC/ARM_CM0/port.c new/Source/portable/GCC/ARM_CM0/port.c
--- org/Source/portable/GCC/ARM_CM0/port.c 2017-11-28 13:48:34.000000000 -0800
+++ new/Source/portable/GCC/ARM_CM0/port.c 2017-12-11 01:11:45.061429000 -0800
## -333,13 +333,19 ## void xPortSysTickHandler( void )
uint32_t ulPreviousMask;
ulPreviousMask = portSET_INTERRUPT_MASK_FROM_ISR();
+ traceISR_ENTER();
{
/* Increment the RTOS tick. */
if( xTaskIncrementTick() != pdFALSE )
{
+ traceISR_EXIT_TO_SCHEDULER();
/* Pend a context switch. */
*(portNVIC_INT_CTRL) = portNVIC_PENDSVSET;
}
+ else
+ {
+ traceISR_EXIT();
+ }
}
portCLEAR_INTERRUPT_MASK_FROM_ISR( ulPreviousMask );
}
diff -rupN org/Source/portable/GCC/ARM_CM0/portmacro.h new/Source/portable/GCC/ARM_CM0/portmacro.h
--- org/Source/portable/GCC/ARM_CM0/portmacro.h 2017-11-28 13:48:34.000000000 -0800
+++ new/Source/portable/GCC/ARM_CM0/portmacro.h 2017-12-11 01:10:27.732228000 -0800
## -82,7 +82,7 ## extern void vPortYield( void );
#define portNVIC_INT_CTRL_REG ( * ( ( volatile uint32_t * ) 0xe000ed04 ) )
#define portNVIC_PENDSVSET_BIT ( 1UL << 28UL )
#define portYIELD() vPortYield()
-#define portEND_SWITCHING_ISR( xSwitchRequired ) if( xSwitchRequired ) portNVIC_INT_CTRL_REG = portNVIC_PENDSVSET_BIT
+#define portEND_SWITCHING_ISR( xSwitchRequired ) { if( xSwitchRequired ) { traceISR_EXIT_TO_SCHEDULER(); portNVIC_INT_CTRL_REG = portNVIC_PENDSVSET_BIT; } else { traceISR_EXIT(); } }
#define portYIELD_FROM_ISR( x ) portEND_SWITCHING_ISR( x )
/*-----------------------------------------------------------*/
diff -rupN org/Source/portable/GCC/ARM_CM3/port.c new/Source/portable/GCC/ARM_CM3/port.c
--- org/Source/portable/GCC/ARM_CM3/port.c 2017-11-28 13:48:34.000000000 -0800
+++ new/Source/portable/GCC/ARM_CM3/port.c 2017-12-11 01:14:50.515630000 -0800
## -431,14 +431,20 ## void xPortSysTickHandler( void )
save and then restore the interrupt mask value as its value is already
known. */
portDISABLE_INTERRUPTS();
+ traceISR_ENTER();
{
/* Increment the RTOS tick. */
if( xTaskIncrementTick() != pdFALSE )
{
+ traceISR_EXIT_TO_SCHEDULER();
/* A context switch is required. Context switching is performed in
the PendSV interrupt. Pend the PendSV interrupt. */
portNVIC_INT_CTRL_REG = portNVIC_PENDSVSET_BIT;
}
+ else
+ {
+ traceISR_EXIT();
+ }
}
portENABLE_INTERRUPTS();
}
diff -rupN org/Source/portable/GCC/ARM_CM3/portmacro.h new/Source/portable/GCC/ARM_CM3/portmacro.h
--- org/Source/portable/GCC/ARM_CM3/portmacro.h 2017-11-28 13:48:34.000000000 -0800
+++ new/Source/portable/GCC/ARM_CM3/portmacro.h 2017-12-11 01:13:36.868029000 -0800
## -90,7 +90,7 ## typedef unsigned long UBaseType_t;
#define portNVIC_INT_CTRL_REG ( * ( ( volatile uint32_t * ) 0xe000ed04 ) )
#define portNVIC_PENDSVSET_BIT ( 1UL << 28UL )
-#define portEND_SWITCHING_ISR( xSwitchRequired ) if( xSwitchRequired != pdFALSE ) portYIELD()
+#define portEND_SWITCHING_ISR( xSwitchRequired ) {} if( xSwitchRequired != pdFALSE ) { traceISR_EXIT_TO_SCHEDULER(); portYIELD() } else { traceISR_EXIT(); } }
#define portYIELD_FROM_ISR( x ) portEND_SWITCHING_ISR( x )
/*-----------------------------------------------------------*/
diff -rupN org/Source/portable/GCC/ARM_CM4F/port.c new/Source/portable/GCC/ARM_CM4F/port.c
--- org/Source/portable/GCC/ARM_CM4F/port.c 2017-11-28 13:48:34.000000000 -0800
+++ new/Source/portable/GCC/ARM_CM4F/port.c 2017-12-11 01:16:01.771230000 -0800
## -493,14 +493,20 ## void xPortSysTickHandler( void )
save and then restore the interrupt mask value as its value is already
known. */
portDISABLE_INTERRUPTS();
+ traceISR_ENTER();
{
/* Increment the RTOS tick. */
if( xTaskIncrementTick() != pdFALSE )
{
+ traceISR_EXIT_TO_SCHEDULER();
/* A context switch is required. Context switching is performed in
the PendSV interrupt. Pend the PendSV interrupt. */
portNVIC_INT_CTRL_REG = portNVIC_PENDSVSET_BIT;
}
+ else
+ {
+ traceISR_EXIT();
+ }
}
portENABLE_INTERRUPTS();
}
diff -rupN org/Source/portable/GCC/ARM_CM4F/portmacro.h new/Source/portable/GCC/ARM_CM4F/portmacro.h
--- org/Source/portable/GCC/ARM_CM4F/portmacro.h 2017-11-28 13:48:34.000000000 -0800
+++ new/Source/portable/GCC/ARM_CM4F/portmacro.h 2017-12-11 01:15:16.546830000 -0800
## -90,7 +90,7 ## typedef unsigned long UBaseType_t;
#define portNVIC_INT_CTRL_REG ( * ( ( volatile uint32_t * ) 0xe000ed04 ) )
#define portNVIC_PENDSVSET_BIT ( 1UL << 28UL )
-#define portEND_SWITCHING_ISR( xSwitchRequired ) if( xSwitchRequired != pdFALSE ) portYIELD()
+#define portEND_SWITCHING_ISR( xSwitchRequired ) { if( xSwitchRequired != pdFALSE ) { traceISR_EXIT_TO_SCHEDULER(); portYIELD(); } else { traceISR_EXIT(); } }
#define portYIELD_FROM_ISR( x ) portEND_SWITCHING_ISR( x )
/*-----------------------------------------------------------*/
diff -rupN org/Source/tasks.c new/Source/tasks.c
--- org/Source/tasks.c 2017-11-28 13:48:34.000000000 -0800
+++ new/Source/tasks.c 2017-12-11 01:08:48.591428000 -0800
## -237,6 +237,17 ## count overflows. */
taskRECORD_READY_PRIORITY( ( pxTCB )->uxPriority ); \
vListInsertEnd( &( pxReadyTasksLists[ ( pxTCB )->uxPriority ] ), &( ( pxTCB )->xStateListItem ) ); \
tracePOST_MOVED_TASK_TO_READY_STATE( pxTCB )
+
+/*
+ * Place the task represented by pxTCB which has been in a ready list before
+ * into the appropriate ready list for the task.
+ * It is inserted at the end of the list.
+ */
+#define prvReaddTaskToReadyList( pxTCB ) \
+ traceREADDED_TASK_TO_READY_STATE( pxTCB ); \
+ taskRECORD_READY_PRIORITY( ( pxTCB )->uxPriority ); \
+ vListInsertEnd( &( pxReadyTasksLists[ ( pxTCB )->uxPriority ] ), &( ( pxTCB )->xStateListItem ) ); \
+ tracePOST_MOVED_TASK_TO_READY_STATE( pxTCB )
/*-----------------------------------------------------------*/
/*
## -1598,7 +1609,7 ## static void prvAddNewTaskToReadyList( TC
{
mtCOVERAGE_TEST_MARKER();
}
- prvAddTaskToReadyList( pxTCB );
+ prvReaddTaskToReadyList( pxTCB );
}
else
{
## -1659,7 +1670,7 ## static void prvAddNewTaskToReadyList( TC
{
mtCOVERAGE_TEST_MARKER();
}
-
+ traceMOVED_TASK_TO_SUSPENDED_LIST(pxTCB);
vListInsertEnd( &xSuspendedTaskList, &( pxTCB->xStateListItem ) );
#if( configUSE_TASK_NOTIFICATIONS == 1 )
## -3671,6 +3682,20 ## static void prvCheckTasksWaitingTerminat
#endif /* INCLUDE_uxTaskGetStackHighWaterMark */
/*-----------------------------------------------------------*/
+#if (INCLUDE_pxTaskGetStackStart == 1)
+ uint8_t* pxTaskGetStackStart( TaskHandle_t xTask)
+ {
+ TCB_t *pxTCB;
+ UBaseType_t uxReturn;
+ (void)uxReturn;
+
+ pxTCB = prvGetTCBFromHandle( xTask );
+ return ( uint8_t * ) pxTCB->pxStack;
+ }
+
+#endif /* INCLUDE_pxTaskGetStackStart */
+/*-----------------------------------------------------------*/
+
#if ( INCLUDE_vTaskDelete == 1 )
static void prvDeleteTCB( TCB_t *pxTCB )
## -3840,7 +3865,7 ## TCB_t *pxTCB;
/* Inherit the priority before being moved into the new list. */
pxMutexHolderTCB->uxPriority = pxCurrentTCB->uxPriority;
- prvAddTaskToReadyList( pxMutexHolderTCB );
+ prvReaddTaskToReadyList( pxMutexHolderTCB );
}
else
{
## -3930,7 +3955,7 ## TCB_t *pxTCB;
any other purpose if this task is running, and it must be
running to give back the mutex. */
listSET_LIST_ITEM_VALUE( &( pxTCB->xEventListItem ), ( TickType_t ) configMAX_PRIORITIES - ( TickType_t ) pxTCB->uxPriority ); /*lint !e961 MISRA exception as the casts are only redundant for some ports. */
- prvAddTaskToReadyList( pxTCB );
+ prvReaddTaskToReadyList( pxTCB );
/* Return true to indicate that a context switch is required.
This is only actually required in the corner case whereby
## -4940,6 +4965,7 ## const TickType_t xConstTickCount = xTick
/* Add the task to the suspended task list instead of a delayed task
list to ensure it is not woken by a timing event. It will block
indefinitely. */
+ traceMOVED_TASK_TO_SUSPENDED_LIST(pxCurrentTCB);
vListInsertEnd( &xSuspendedTaskList, &( pxCurrentTCB->xStateListItem ) );
}
else
## -4956,12 +4982,14 ## const TickType_t xConstTickCount = xTick
{
/* Wake time has overflowed. Place this item in the overflow
list. */
+ traceMOVED_TASK_TO_OVERFLOW_DELAYED_LIST();
vListInsert( pxOverflowDelayedTaskList, &( pxCurrentTCB->xStateListItem ) );
}
else
{
/* The wake time has not overflowed, so the current block list
is used. */
+ traceMOVED_TASK_TO_DELAYED_LIST();
vListInsert( pxDelayedTaskList, &( pxCurrentTCB->xStateListItem ) );
/* If the task entering the blocked state was placed at the
## -4991,11 +5019,13 ## const TickType_t xConstTickCount = xTick
if( xTimeToWake < xConstTickCount )
{
/* Wake time has overflowed. Place this item in the overflow list. */
+ traceMOVED_TASK_TO_OVERFLOW_DELAYED_LIST();
vListInsert( pxOverflowDelayedTaskList, &( pxCurrentTCB->xStateListItem ) );
}
else
{
/* The wake time has not overflowed, so the current block list is used. */
+ traceMOVED_TASK_TO_DELAYED_LIST();
vListInsert( pxDelayedTaskList, &( pxCurrentTCB->xStateListItem ) );
/* If the task entering the blocked state was placed at the head of the
I tried to run this .patch file in my windows bash like this
$ patch /c/Users/ps/Documents/Git/STM32L432/Middlewares/Third_Party/FreeRTOS /c/Users/ps/Documents/Git/STM32L432/SEGGER/FreeRTOSV10/Patch/FreeRTOSV10_Core.patch
But I get the following error message
File /c/Users/ps/Documents/Git/STM32L432/Middlewares/Third_Party/FreeRTOS is not a regular file -- refusing to patch
Of course, the path /c/Users/ps/Documents/Git/STM32L432/Middlewares/Third_Party/FreeRTOS isn't a path to a file but it should be the root path for all diff cmd's. So how to determine a root path or concatenate more that one path to use a .patch file with several diffs inside?
BTW:
$ patch --help
Usage: patch [OPTION]... [ORIGFILE [PATCHFILE]]
Doesn't help me...
EDIT 1
Now I tried to run my bash from the Source directory and try the patch call like this
PS#PCENTW-PS MINGW64 ~/Documents/Git/STM32L432/Middlewares/Third_Party/FreeRTOS/Source (UseSystemView)
$ patch < /c/Users/ps/Documents/Git/STM32L432/SEGGER/FreeRTOSV10/Patch/FreeRTOSV10_Core.patch
can't find file to patch at input line 4
Perhaps you should have used the -p or --strip option?
The text leading up to this was:
--------------------------
|diff -rupN org/Source/include/FreeRTOS.h new/Source/include/FreeRTOS.h
|--- org/Source/include/FreeRTOS.h 2017-11-28 13:48:34.000000000 -0800
|+++ new/Source/include/FreeRTOS.h 2017-12-11 00:54:49.522222000 -0800
--------------------------
File to patch:
This seems to be much better than my previous call. But regardless I get the error can't find file to patch at input line 4
Open cmd.exe
Switch to the Source directory where all files are located
$ cd .../Source
Run patch.exe
$ patch < .../FreeRTOSV10_Core.patch
Determine the specific files to patch
File to patch: .../FreeRTOS.h
FINISH